From 8d75ea43059a50a3352723e4b7dc0423e58ef4e6 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 5 Dec 2026 17:51:30 +0000 Subject: [PATCH 1/2] Move single-example modules out of core/ into examples// core/ now holds only modules several examples (or projects) share. An example with modules of its own lives in examples//.ts beside them (golden_line, hologram, clustered_geometry, fast_block_compress, sakura_forest_ser, opacity_micromaps, memory_management, denoised_rtao, rtxdi_minimal, rtxmg_demo, rtxpt, video_texture). CMake finds the main source through tslang_example_main; generate_donut_wrappers.py writes the moved generated modules to their example folders. Co-Authored-By: Claude Opus 5.5 --- CMakeLists.txt | 92 +++++++++++-------- README.md | 20 ++-- core/interop/rtxdi_minimal.d.ts | 2 +- core/interop/rtxmg.d.ts | 2 +- core/interop/rtxpt.d.ts | 2 +- core/rtxdi_minimal.cpp | 6 +- core/rtxpt.cpp | 16 ++-- core/web_audio.cpp | 4 +- docs/clustered_geometry_vulkan_gpu_faults.md | 2 +- .../plans/2026-11-07-rtxmg-cluster-tess.md | 4 +- .../plans/2026-11-08-rtxdi-minimal.md | 18 ++-- .../specs/2026-11-08-rtxdi-minimal-design.md | 8 +- {core => examples/clustered_geometry}/clas.ts | 7 +- .../clustered_geometry.ts | 12 +-- examples/{ => denoised_rtao}/denoised_rtao.ts | 10 +- .../denoised_rtao}/pbrt_scene.ts | 8 +- .../fast_block_compress.ts | 10 +- .../fast_block_compress}/fbc_texture.ts | 8 +- examples/{ => golden_line}/golden_line.ts | 48 +++++----- .../golden_line}/golden_line_bake.ts | 0 .../golden_line}/golden_line_birds.ts | 4 +- .../golden_line}/golden_line_bloom.ts | 4 +- .../golden_line}/golden_line_bridgekit.ts | 0 .../golden_line}/golden_line_bridges.ts | 0 .../golden_line}/golden_line_cab.ts | 0 .../golden_line}/golden_line_coach.ts | 0 .../golden_line}/golden_line_extrude.ts | 2 +- .../golden_line}/golden_line_grass.ts | 6 +- .../golden_line}/golden_line_houses.ts | 0 .../golden_line}/golden_line_hud.ts | 4 +- .../golden_line}/golden_line_lineside.ts | 0 .../golden_line}/golden_line_loco.ts | 0 .../golden_line}/golden_line_motes.ts | 4 +- .../golden_line}/golden_line_plume.ts | 2 +- .../golden_line}/golden_line_portal.ts | 0 .../golden_line}/golden_line_puffs.ts | 2 +- .../golden_line}/golden_line_saloon.ts | 2 +- .../golden_line}/golden_line_shadowfit.ts | 0 .../golden_line}/golden_line_shadows.ts | 2 +- .../golden_line}/golden_line_shots.ts | 2 +- .../golden_line}/golden_line_signs.ts | 0 .../golden_line}/golden_line_sound.ts | 0 .../golden_line}/golden_line_soundbank.ts | 0 .../golden_line}/golden_line_station.ts | 0 .../golden_line}/golden_line_steam.ts | 4 +- .../golden_line}/golden_line_structkit.ts | 0 .../golden_line}/golden_line_structures.ts | 2 +- .../golden_line}/golden_line_surfaces.ts | 2 +- .../golden_line}/golden_line_tender.ts | 0 .../golden_line}/golden_line_textures.ts | 2 +- .../golden_line}/golden_line_trackway.ts | 0 .../golden_line}/golden_line_train.ts | 6 +- .../golden_line}/golden_line_traingeo.ts | 2 +- .../golden_line}/golden_line_treegen.ts | 2 +- .../golden_line}/golden_line_trees.ts | 2 +- .../golden_line}/golden_line_tunnel.ts | 0 .../golden_line}/golden_line_vegetation.ts | 8 +- .../golden_line}/golden_line_water.ts | 4 +- .../golden_line}/golden_line_wheels.ts | 0 .../golden_line}/golden_line_world.ts | 2 +- {core => examples/golden_line}/web_audio.ts | 7 +- examples/{ => hologram}/hologram.ts | 8 +- .../hologram}/hologram_teapot.ts | 0 .../memory_management.ts | 6 +- .../memory_management}/paged_images.ts | 8 +- .../opacity_micromaps}/omm_bake.ts | 7 +- .../opacity_micromaps.ts | 10 +- {core => examples/rtxdi_minimal}/rtxdi_di.ts | 6 +- examples/{ => rtxdi_minimal}/rtxdi_minimal.ts | 12 +-- {core => examples/rtxmg_demo}/rtxmg.ts | 8 +- examples/{ => rtxmg_demo}/rtxmg_demo.ts | 6 +- examples/{ => rtxpt}/rtxpt.ts | 10 +- {core => examples/rtxpt}/rtxpt_renderer.ts | 8 +- .../sakura_forest_ser}/obj_model.ts | 7 +- .../sakura_forest_ser.ts | 10 +- .../video_texture}/video_player.ts | 8 +- examples/{ => video_texture}/video_texture.ts | 10 +- run_jit_rtxdi.bat | 2 +- .../clustered_geometry/RaytracingHlslCompat.h | 2 +- shaders/golden_line.hlsl | 2 +- shaders/golden_line_birds.hlsl | 2 +- shaders/golden_line_bloom.hlsl | 2 +- shaders/golden_line_hud.hlsl | 4 +- shaders/golden_line_motes.hlsl | 2 +- shaders/golden_line_puffs.hlsl | 2 +- shaders/memory_management.hlsl | 2 +- shaders/rtxdi_minimal.cfg | 2 +- shaders/rtxpt.cfg | 2 +- shaders/sakura_forest_ser.hlsl | 2 +- tools/capture_screenshots.ps1 | 2 +- tools/find_untyped_handles.py | 4 +- tools/generate_donut_wrappers.py | 33 ++++++- tools/smoke_examples.ps1 | 2 +- tsconfig.json | 2 +- 94 files changed, 294 insertions(+), 255 deletions(-) rename {core => examples/clustered_geometry}/clas.ts (96%) rename examples/{ => clustered_geometry}/clustered_geometry.ts (99%) rename examples/{ => denoised_rtao}/denoised_rtao.ts (99%) rename {core => examples/denoised_rtao}/pbrt_scene.ts (94%) rename examples/{ => fast_block_compress}/fast_block_compress.ts (99%) rename {core => examples/fast_block_compress}/fbc_texture.ts (90%) rename examples/{ => golden_line}/golden_line.ts (98%) rename {core => examples/golden_line}/golden_line_bake.ts (100%) rename {core => examples/golden_line}/golden_line_birds.ts (99%) rename {core => examples/golden_line}/golden_line_bloom.ts (99%) rename {core => examples/golden_line}/golden_line_bridgekit.ts (100%) rename {core => examples/golden_line}/golden_line_bridges.ts (100%) rename {core => examples/golden_line}/golden_line_cab.ts (100%) rename {core => examples/golden_line}/golden_line_coach.ts (100%) rename {core => examples/golden_line}/golden_line_extrude.ts (99%) rename {core => examples/golden_line}/golden_line_grass.ts (99%) rename {core => examples/golden_line}/golden_line_houses.ts (100%) rename {core => examples/golden_line}/golden_line_hud.ts (99%) rename {core => examples/golden_line}/golden_line_lineside.ts (100%) rename {core => examples/golden_line}/golden_line_loco.ts (100%) rename {core => examples/golden_line}/golden_line_motes.ts (98%) rename {core => examples/golden_line}/golden_line_plume.ts (99%) rename {core => examples/golden_line}/golden_line_portal.ts (100%) rename {core => examples/golden_line}/golden_line_puffs.ts (99%) rename {core => examples/golden_line}/golden_line_saloon.ts (99%) rename {core => examples/golden_line}/golden_line_shadowfit.ts (100%) rename {core => examples/golden_line}/golden_line_shadows.ts (98%) rename {core => examples/golden_line}/golden_line_shots.ts (99%) rename {core => examples/golden_line}/golden_line_signs.ts (100%) rename {core => examples/golden_line}/golden_line_sound.ts (100%) rename {core => examples/golden_line}/golden_line_soundbank.ts (100%) rename {core => examples/golden_line}/golden_line_station.ts (100%) rename {core => examples/golden_line}/golden_line_steam.ts (99%) rename {core => examples/golden_line}/golden_line_structkit.ts (100%) rename {core => examples/golden_line}/golden_line_structures.ts (99%) rename {core => examples/golden_line}/golden_line_surfaces.ts (99%) rename {core => examples/golden_line}/golden_line_tender.ts (100%) rename {core => examples/golden_line}/golden_line_textures.ts (99%) rename {core => examples/golden_line}/golden_line_trackway.ts (100%) rename {core => examples/golden_line}/golden_line_train.ts (99%) rename {core => examples/golden_line}/golden_line_traingeo.ts (99%) rename {core => examples/golden_line}/golden_line_treegen.ts (99%) rename {core => examples/golden_line}/golden_line_trees.ts (99%) rename {core => examples/golden_line}/golden_line_tunnel.ts (100%) rename {core => examples/golden_line}/golden_line_vegetation.ts (99%) rename {core => examples/golden_line}/golden_line_water.ts (99%) rename {core => examples/golden_line}/golden_line_wheels.ts (100%) rename {core => examples/golden_line}/golden_line_world.ts (99%) rename {core => examples/golden_line}/web_audio.ts (95%) rename examples/{ => hologram}/hologram.ts (99%) rename {core => examples/hologram}/hologram_teapot.ts (100%) rename examples/{ => memory_management}/memory_management.ts (99%) rename {core => examples/memory_management}/paged_images.ts (94%) rename {core => examples/opacity_micromaps}/omm_bake.ts (93%) rename examples/{ => opacity_micromaps}/opacity_micromaps.ts (99%) rename {core => examples/rtxdi_minimal}/rtxdi_di.ts (98%) rename examples/{ => rtxdi_minimal}/rtxdi_minimal.ts (99%) rename {core => examples/rtxmg_demo}/rtxmg.ts (95%) rename examples/{ => rtxmg_demo}/rtxmg_demo.ts (99%) rename examples/{ => rtxpt}/rtxpt.ts (99%) rename {core => examples/rtxpt}/rtxpt_renderer.ts (95%) rename {core => examples/sakura_forest_ser}/obj_model.ts (88%) rename examples/{ => sakura_forest_ser}/sakura_forest_ser.ts (99%) rename {core => examples/video_texture}/video_player.ts (91%) rename examples/{ => video_texture}/video_texture.ts (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c46aad3..ba558c2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -986,7 +986,7 @@ elseif(NOT WIN32) list(APPEND TSLANG_LINK_LIBS "stdc++" "m" "pthread" "dl" "rt") endif() -# One executable per example, built from examples/.ts, plus any further sources given after the name. +# One executable per example, built from examples/.ts (or examples//.ts), plus any further sources given after the name. # Its shaders, if any (the _shaders target), must be compiled into # bin/shaders//: donut_interop loads them from the folder named after the # executable. @@ -1062,6 +1062,17 @@ if (ANDROID) endif() endif() +# The main source of the example : examples//.ts when the example has modules of +# its own (they sit beside it in examples//; core/ holds what several examples share), else +# examples/.ts. +function(tslang_example_main name out) + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples/${name}/${name}.ts") + set(${out} examples/${name}/${name}.ts PARENT_SCOPE) + else() + set(${out} examples/${name}.ts PARENT_SCOPE) + endif() +endfunction() + # lib.so and bin/.apk (see above), with the media files and folders listed in # (paths in the media folder) and the further sources after it. Its shaders are # _shaders', or with SHADERS , that target's (shaders/). @@ -1070,7 +1081,7 @@ endif() # examples/nri/.ts instead of examples/.ts. function(add_tslang_android_app name media) cmake_parse_arguments(PARSE_ARGV 2 APP "NRI" "SHADERS;SOURCE" "") - set(source examples/${name}.ts) + tslang_example_main(${name} source) if (APP_SOURCE) set(source ${APP_SOURCE}) elseif (APP_NRI) @@ -1394,15 +1405,16 @@ endforeach() add_library(tslang_core OBJECT ${TSLANG_CORE_SOURCES}) tslang_own_facts(${TSLANG_CORE_SOURCES}) -# add_tslang_example( [MEDIA ...] [...]): examples/.ts and the further +# add_tslang_example( [MEDIA ...] [...]): its main source (tslang_example_main) and the further # sources. MEDIA lists the files and folders of the media folder it reads (paths in it), which # go into its APK on Android; on the desktop the whole folder is next to the executables. function(add_tslang_example name) cmake_parse_arguments(PARSE_ARGV 1 EXAMPLE "" "" "MEDIA") + tslang_example_main(${name} main) # .ts files compile with the TSLANG command. Most targets have no .cpp, so link with the C++ # rule explicitly: the C++ link flags (debug info, CRT) apply and the tslang compile flags # stay off the link line. - add_executable(${name} examples/${name}.ts ${EXAMPLE_UNPARSED_ARGUMENTS}) + add_executable(${name} ${main} ${EXAMPLE_UNPARSED_ARGUMENTS}) set(module_ts ${EXAMPLE_UNPARSED_ARGUMENTS}) list(FILTER module_ts INCLUDE REGEX "\\.ts$") # The example imports the modules listed with it, and compiles their declarations in; so may @@ -1410,8 +1422,8 @@ function(add_tslang_example name) set(module_ts_paths ${module_ts}) list(TRANSFORM module_ts_paths PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/") set_source_files_properties(${module_ts} PROPERTIES OBJECT_DEPENDS "${TSLANG_CORE_SOURCES_WITH_DECLARATIONS};${module_ts_paths}") - set_source_files_properties(examples/${name}.ts PROPERTIES OBJECT_DEPENDS "${TSLANG_CORE_SOURCES_WITH_DECLARATIONS};${module_ts_paths}") - tslang_own_facts(examples/${name}.ts ${module_ts}) + set_source_files_properties(${main} PROPERTIES OBJECT_DEPENDS "${TSLANG_CORE_SOURCES_WITH_DECLARATIONS};${module_ts_paths}") + tslang_own_facts(${main} ${module_ts}) set_target_properties(${name} PROPERTIES LINKER_LANGUAGE CXX) target_link_libraries(${name} PRIVATE tslang_core ${TSLANG_LINK_LIBS} donut_interop_static) if (TARGET ${name}_shaders) @@ -3699,7 +3711,7 @@ add_tslang_example_test(dynamic_uniform_buffers_nri) # command lists of their own (draw batches on the thread pool: the sample's secondary command # buffers), each object's parameter block a slice of one constant buffer (the sample's dynamic # offsets). The simulation runs on the main thread (the sample's workers step it too). The teapot -# is core/hologram_teapot.ts (from the sample's Meshes.teapot.h, Chromium's BSD notice kept). +# is examples/hologram/hologram_teapot.ts (from the sample's Meshes.teapot.h, Chromium's BSD notice kept). donut_compile_shaders_all_platforms( TARGET hologram_shaders PROJECT_NAME "Hologram" @@ -3707,7 +3719,7 @@ donut_compile_shaders_all_platforms( SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/shaders/hologram.hlsl OUTPUT_BASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/hologram ) -add_tslang_example(hologram core/hologram_teapot.ts) +add_tslang_example(hologram examples/hologram/hologram_teapot.ts) if (TSLANG_MEMORY_MODEL STREQUAL "own") # -mm=own refuses the icosphere builder keeping a borrowed array element in a field of a # temporary (TSLANG_ISSUES.md 228): count that object until tslang accepts it. After the global @@ -3719,12 +3731,12 @@ add_tslang_example_test(hologram SUFFIX single_threaded ARGS -s) # Port of golden-line (github.com/StarKnightt/golden-line, MIT), a three.js WebGPU page: an endless # railway through countryside at golden hour. Its ground and sky so far: the world generated on the -# CPU as the original does (core/golden_line_world.ts, checked against the original's arrays), its -# terrain and atmosphere node materials in shaders/golden_line.hlsl; its trees (core/golden_line_trees.ts, +# CPU as the original does (examples/golden_line/golden_line_world.ts, checked against the original's arrays), its +# terrain and atmosphere node materials in shaders/golden_line.hlsl; its trees (examples/golden_line/golden_line_trees.ts, # _treegen.ts, _textures.ts, _vegetation.ts) culled and drawn by shaders/golden_line_trees.hlsl; its water -# (core/golden_line_water.ts, shaders/golden_line_water.hlsl) with a planar mirror; its grass, wheat, -# flowers and reeds (core/golden_line_grass.ts, shaders/golden_line_grass.hlsl); its train -# (core/golden_line_train.ts with the meshes of _loco.ts, _tender.ts, _coach.ts, built with the three.js +# (examples/golden_line/golden_line_water.ts, shaders/golden_line_water.hlsl) with a planar mirror; its grass, wheat, +# flowers and reeds (examples/golden_line/golden_line_grass.ts, shaders/golden_line_grass.hlsl); its train +# (examples/golden_line/golden_line_train.ts with the meshes of _loco.ts, _tender.ts, _coach.ts, built with the three.js # geometry ports of _traingeo.ts, _extrude.ts and _wheels.ts; shaders/golden_line_train.hlsl), and inside # it the footplate with its crew (_cab.ts) and the furnished saloon (_saloon.ts, its light baked by _bake.ts; # shaders/golden_line_interior.hlsl); and its structures beside the line: the track and sleepers (_trackway.ts), @@ -3741,17 +3753,17 @@ donut_compile_shaders_all_platforms( ${CMAKE_CURRENT_SOURCE_DIR}/shaders/golden_line_structures.hlsl ${CMAKE_CURRENT_SOURCE_DIR}/shaders/golden_line_hud.hlsl OUTPUT_BASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/golden_line ) -add_tslang_example(golden_line core/golden_line_world.ts core/golden_line_trees.ts core/golden_line_treegen.ts - core/golden_line_textures.ts core/golden_line_vegetation.ts core/golden_line_water.ts core/golden_line_grass.ts - core/golden_line_train.ts core/golden_line_traingeo.ts core/golden_line_extrude.ts core/golden_line_wheels.ts - core/golden_line_loco.ts core/golden_line_tender.ts core/golden_line_coach.ts core/golden_line_cab.ts core/golden_line_saloon.ts core/golden_line_bake.ts - core/golden_line_structkit.ts core/golden_line_surfaces.ts core/golden_line_trackway.ts core/golden_line_lineside.ts - core/golden_line_structures.ts core/golden_line_bridgekit.ts core/golden_line_bridges.ts - core/golden_line_tunnel.ts core/golden_line_portal.ts core/golden_line_houses.ts core/golden_line_station.ts - core/golden_line_signs.ts - core/golden_line_shadowfit.ts core/golden_line_shadows.ts core/golden_line_puffs.ts - core/golden_line_plume.ts core/golden_line_steam.ts core/golden_line_birds.ts core/golden_line_motes.ts core/golden_line_bloom.ts core/golden_line_shots.ts - core/golden_line_hud.ts core/golden_line_soundbank.ts core/golden_line_sound.ts core/web_audio.ts core/web_audio.cpp) +add_tslang_example(golden_line examples/golden_line/golden_line_world.ts examples/golden_line/golden_line_trees.ts examples/golden_line/golden_line_treegen.ts + examples/golden_line/golden_line_textures.ts examples/golden_line/golden_line_vegetation.ts examples/golden_line/golden_line_water.ts examples/golden_line/golden_line_grass.ts + examples/golden_line/golden_line_train.ts examples/golden_line/golden_line_traingeo.ts examples/golden_line/golden_line_extrude.ts examples/golden_line/golden_line_wheels.ts + examples/golden_line/golden_line_loco.ts examples/golden_line/golden_line_tender.ts examples/golden_line/golden_line_coach.ts examples/golden_line/golden_line_cab.ts examples/golden_line/golden_line_saloon.ts examples/golden_line/golden_line_bake.ts + examples/golden_line/golden_line_structkit.ts examples/golden_line/golden_line_surfaces.ts examples/golden_line/golden_line_trackway.ts examples/golden_line/golden_line_lineside.ts + examples/golden_line/golden_line_structures.ts examples/golden_line/golden_line_bridgekit.ts examples/golden_line/golden_line_bridges.ts + examples/golden_line/golden_line_tunnel.ts examples/golden_line/golden_line_portal.ts examples/golden_line/golden_line_houses.ts examples/golden_line/golden_line_station.ts + examples/golden_line/golden_line_signs.ts + examples/golden_line/golden_line_shadowfit.ts examples/golden_line/golden_line_shadows.ts examples/golden_line/golden_line_puffs.ts + examples/golden_line/golden_line_plume.ts examples/golden_line/golden_line_steam.ts examples/golden_line/golden_line_birds.ts examples/golden_line/golden_line_motes.ts examples/golden_line/golden_line_bloom.ts examples/golden_line/golden_line_shots.ts + examples/golden_line/golden_line_hud.ts examples/golden_line/golden_line_soundbank.ts examples/golden_line/golden_line_sound.ts examples/golden_line/web_audio.ts core/web_audio.cpp) target_link_libraries(golden_line PRIVATE ${WEB_AUDIO_LIBRARIES}) add_tslang_example_test(golden_line) add_tslang_example_test(golden_line SUFFIX cab ARGS -shot cab) @@ -4060,7 +4072,7 @@ donut_compile_shaders_all_platforms( ${CMAKE_CURRENT_SOURCE_DIR}/shaders/fast_block_compress_quad.hlsl OUTPUT_BASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/fast_block_compress ) -add_tslang_example(fast_block_compress core/text_format.ts core/fbc_texture.ts core/fast_block_compress.cpp core/fbc_cpu.cpp MEDIA fast_block_compress) +add_tslang_example(fast_block_compress core/text_format.ts examples/fast_block_compress/fbc_texture.ts core/fast_block_compress.cpp core/fbc_cpu.cpp MEDIA fast_block_compress) add_tslang_example_test(fast_block_compress) if (XBOX_ATG_SAMPLES_DIR) set(fbc_media) @@ -4115,7 +4127,7 @@ if (WIN32) SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/shaders/video_texture.hlsl OUTPUT_BASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/video_texture ) - add_tslang_example(video_texture core/matrix.ts core/video_player.ts core/video_player.cpp MEDIA fonts video_texture) + add_tslang_example(video_texture core/matrix.ts examples/video_texture/video_player.ts core/video_player.cpp MEDIA fonts video_texture) add_tslang_example_test(video_texture) target_link_libraries(video_texture PRIVATE delayimp) target_link_options(video_texture PRIVATE /DELAYLOAD:mfplat.dll) @@ -4480,10 +4492,10 @@ donut_compile_shaders( SPIRV_DXC ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/opacity_micromaps/spirv ) if (NVRHI_WITH_DX12) - add_tslang_example(opacity_micromaps core/directx_math.ts core/omm_bake.ts core/omm_bake.cpp core/d3d12_agility_sdk.cpp + add_tslang_example(opacity_micromaps core/directx_math.ts examples/opacity_micromaps/omm_bake.ts core/omm_bake.cpp core/d3d12_agility_sdk.cpp MEDIA fonts opacity_micromaps) else() - add_tslang_example(opacity_micromaps core/directx_math.ts core/omm_bake.ts core/omm_bake.cpp MEDIA fonts opacity_micromaps) + add_tslang_example(opacity_micromaps core/directx_math.ts examples/opacity_micromaps/omm_bake.ts core/omm_bake.cpp MEDIA fonts opacity_micromaps) endif() target_link_libraries(opacity_micromaps PRIVATE ${OMM_SDK_LIBRARIES}) add_tslang_example_test(opacity_micromaps) @@ -4590,7 +4602,7 @@ donut_compile_shaders( ) if (D3D12_PREVIEW_SDK_VERSION AND DXC_PREVIEW_PATH) # core/ptlas.cpp: Donut_EnableD3D12RaytracingPreview. - add_tslang_example(clustered_geometry core/directx_math.ts core/text_format.ts core/clas.ts core/clas.cpp core/ptlas.cpp core/d3d12_preview_sdk.cpp) + add_tslang_example(clustered_geometry core/directx_math.ts core/text_format.ts examples/clustered_geometry/clas.ts core/clas.cpp core/ptlas.cpp core/d3d12_preview_sdk.cpp) add_tslang_example_test(clustered_geometry APIS dx12) # The traditional path (a DXR1 BLAS per object), COMPRESSED1 vertices, and settings switched while it # runs (rebuilds: traditional and back, 1000 clones, CLASes sized first). @@ -4599,7 +4611,7 @@ if (D3D12_PREVIEW_SDK_VERSION AND DXC_PREVIEW_PATH) add_tslang_example_test(clustered_geometry SUFFIX switches APIS dx12 ARGS -at 1:geom-traditional -at 2:geom-clusters -at 2:extra-1k -at 3:alloc-getsizes) else() - add_tslang_example(clustered_geometry core/directx_math.ts core/text_format.ts core/clas.ts core/clas.cpp core/ptlas.cpp) + add_tslang_example(clustered_geometry core/directx_math.ts core/text_format.ts examples/clustered_geometry/clas.ts core/clas.cpp core/ptlas.cpp) endif() add_dependencies(clustered_geometry clustered_geometry_spirv_shaders) add_tslang_example_test(clustered_geometry APIS vk) @@ -4876,7 +4888,7 @@ if (WIN32) SPIRV_DXC ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/denoised_rtao/spirv SHADERMAKE_OPTIONS_SPIRV "--vulkanMemoryLayout dx" ) - add_tslang_example(denoised_rtao core/directx_math.ts core/pbrt_scene.ts core/denoised_rtao.cpp core/pbrt/PBRTParser.cpp core/pbrt/PlyParser.cpp + add_tslang_example(denoised_rtao core/directx_math.ts examples/denoised_rtao/pbrt_scene.ts core/denoised_rtao.cpp core/pbrt/PBRTParser.cpp core/pbrt/PlyParser.cpp MEDIA denoised_rtao) add_dxgs_media_directory(denoised_rtao denoised_rtao Samples/Desktop/D3D12Raytracing/src/D3D12RaytracingRealTimeDenoisedAmbientOcclusion/Assets) @@ -5045,7 +5057,7 @@ if (NVRHI_WITH_DX12) DXIL ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/sakura_forest_ser/dxil SHADER_MODEL 6_9 ) - add_tslang_example(sakura_forest_ser core/directx_math.ts core/obj_model.ts core/obj_model.cpp core/d3d12_agility_sdk.cpp + add_tslang_example(sakura_forest_ser core/directx_math.ts examples/sakura_forest_ser/obj_model.ts core/obj_model.cpp core/d3d12_agility_sdk.cpp MEDIA fonts) set(sakura_dir "Samples/Desktop/D3D12Raytracing/src/D3D12RaytracingSakuraForestSER") if (DIRECTX_GRAPHICS_SAMPLES_DIR AND NOT EXISTS "${DIRECTX_GRAPHICS_SAMPLES_DIR}/${sakura_dir}") @@ -5075,7 +5087,7 @@ if (NVRHI_WITH_DX12) SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/shaders/memory_management.hlsl DXIL ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/memory_management/dxil ) - add_tslang_example(memory_management core/paged_images.ts core/paged_images.cpp MEDIA fonts) + add_tslang_example(memory_management examples/memory_management/paged_images.ts core/paged_images.cpp MEDIA fonts) add_dxgs_media(memory_management memory_management TechniqueDemos/D3D12MemoryManagement/src/TileGrid.dds) add_tslang_example_test(memory_management APIS dx12) add_tslang_example_test(memory_management SUFFIX budget APIS dx12 ARGS -budget 512) @@ -5481,7 +5493,7 @@ endif() # Under the NVIDIA RTX SDKs License like RTXCR, so nothing of it is copied here: with RTXPT_DIR set to # a checkout, the sample's renderer library (scene, materials, lights, environment map, the path tracer's # run-time pipeline baker, tone mapping, accumulation: rtxpt_core) and its shaders compile in place; -# examples/rtxpt.ts is the sample's host (Sample.cpp) and core/rtxpt.cpp the glue. +# examples/rtxpt/rtxpt.ts is the sample's host (Sample.cpp) and core/rtxpt.cpp the glue. if (RTXPT_DIR) # Tracy's headers: RTXPT's code marks profiler zones, which are empty without TRACY_ENABLE. FetchContent_Declare(tracy @@ -5620,9 +5632,9 @@ if (RTXPT_DIR) # The path tracer is shader model 6.9 on D3D12 (DXR 1.2's hit objects): the Agility SDK runtime. if (NVRHI_WITH_DX12) - add_tslang_example(rtxpt core/rtxpt_renderer.ts core/rtxpt_game.ts core/rtxpt.cpp core/d3d12_agility_sdk.cpp MEDIA fonts) + add_tslang_example(rtxpt examples/rtxpt/rtxpt_renderer.ts core/rtxpt_game.ts core/rtxpt.cpp core/d3d12_agility_sdk.cpp MEDIA fonts) else() - add_tslang_example(rtxpt core/rtxpt_renderer.ts core/rtxpt_game.ts core/rtxpt.cpp MEDIA fonts) + add_tslang_example(rtxpt examples/rtxpt/rtxpt_renderer.ts core/rtxpt_game.ts core/rtxpt.cpp MEDIA fonts) endif() add_dependencies(rtxpt rtxpt_shaders rtxpt_nrd_shaders rtxpt_dynamic_shaders) target_link_libraries(rtxpt PRIVATE rtxpt_core) @@ -5722,9 +5734,9 @@ if (RTXDI_DIR) endif() endif() - # core/rtxdi_di.ts: what the RTXDI samples share (the context, resources and light preparation, the + # examples/rtxdi_minimal/rtxdi_di.ts: what the RTXDI samples share (the context, resources and light preparation, the # render targets); add_tslang_example makes rtxdi_minimal depend on rtxdi_minimal_shaders. - add_tslang_example(rtxdi_minimal core/matrix.ts core/text_format.ts core/rtxdi_di.ts ${RTXDI_GLUE_SOURCES} MEDIA fonts) + add_tslang_example(rtxdi_minimal core/matrix.ts core/text_format.ts examples/rtxdi_minimal/rtxdi_di.ts ${RTXDI_GLUE_SOURCES} MEDIA fonts) target_link_libraries(rtxdi_minimal PRIVATE rtxdi_runtime) # Sanity checks (-test), not reference compares: reference comparisons need a build of the original sample # (its MinimalSample.exe, from RTXDI_DIR). noresampling: initial sampling only; unbiased: the sample's @@ -5767,9 +5779,9 @@ if (RTXMG_DIR) unset(SHADERMAKE_DXC_PATH) if (NVRHI_D3D12_WITH_DXRCLUSTER) # The Agility SDK runtime in bin/D3D12, the 1.722 preview with DXR clusters (Developer Mode only). - add_tslang_example(rtxmg_demo core/rtxmg.ts ${RTXMG_GLUE_SOURCES} core/d3d12_agility_sdk.cpp) + add_tslang_example(rtxmg_demo examples/rtxmg_demo/rtxmg.ts ${RTXMG_GLUE_SOURCES} core/d3d12_agility_sdk.cpp) else() - add_tslang_example(rtxmg_demo core/rtxmg.ts ${RTXMG_GLUE_SOURCES}) + add_tslang_example(rtxmg_demo examples/rtxmg_demo/rtxmg.ts ${RTXMG_GLUE_SOURCES}) endif() target_link_libraries(rtxmg_demo PRIVATE rtxmg) add_dependencies(rtxmg_demo rtxmg_demo_shaders cluster_tess_shaders hiz_shaders envmap_shaders) diff --git a/README.md b/README.md index 42f0e68e..19884d99 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ predecessor, [LunarG VulkanSamples](https://github.com/LunarG/VulkanSamples)). Dynamic Uniform Buffers (TypeScript, DirectX 12 / Vulkan). 125 cubes with model matrices in slices of one uniform buffer
Dynamic Uniform Buffers
125 cubes with model matrices in slices of one uniform buffer.Texture Loading (TypeScript, DirectX 12 / Vulkan). A mipmapped texture with an adjustable level-of-detail bias
Texture Loading
A mipmapped texture with an adjustable level-of-detail bias.Separate Image Sampler (TypeScript, DirectX 12 / Vulkan). A sampler bound apart from its image, linear or nearest filtering
Separate Image Sampler
A sampler bound apart from its image, linear or nearest filtering. Dynamic Rendering Local Read (TypeScript, DirectX 12 / Vulkan). Deferred shading with 64 point lights, then forward-rendered glass
Dynamic Rendering Local Read
Deferred shading with 64 point lights, then forward-rendered glass.Shader Object (TypeScript, DirectX 12 / Vulkan). Vertex, geometry and fragment shaders combined at draw time, then post-processed
Shader Object
Vertex, geometry and fragment shaders combined at draw time, then post-processed.Calibrated Timestamps (TypeScript, DirectX 12 / Vulkan). The HDR scene with pieces of its code timed by the GPU clock through calibrated timestamps
Calibrated Timestamps
The HDR scene with pieces of its code timed by the GPU clock through calibrated timestamps. Host Image Copy (TypeScript, DirectX 12 / Vulkan). A textured cube whose texture the CPU writes straight into the image
Host Image Copy
A textured cube whose texture the CPU writes straight into the image, no staging buffer.Buffer Device Address (TypeScript, Vulkan). 64 meshes animated and drawn through GPU pointers only, no descriptors
Buffer Device Address
64 meshes animated and drawn through GPU pointers alone, no descriptors (Vulkan only).Shader debugprintf (TypeScript, Vulkan). Lit spheres whose vertex shader prints positions with printf, shown in the UI
Shader debugprintf
A vertex shader printing positions with printf, read back by the validation layer and shown in the UI (Vulkan only, with the Vulkan SDK). -Push Descriptors (TypeScript, Vulkan). Two textured crates whose descriptors are pushed into the command buffer with each draw
Push Descriptors
Two crates whose descriptors are pushed into the command buffer with each draw, no descriptor sets (Vulkan only).Descriptor Buffers (TypeScript, Vulkan). Two textured crates whose descriptor sets live in plain buffers the CPU writes
Descriptor Buffers
The same crates, their descriptor sets in buffers the CPU writes descriptors into, no pools (Vulkan only).Hologram (TypeScript, DirectX 12 / Vulkan). 5000 pyramids, icospheres and teapots drifting and blended, their draws recorded by worker threads
Hologram
5000 pyramids, icospheres and teapots drifting and blended, their draws recorded on worker threads into command lists of their own. +Push Descriptors (TypeScript, Vulkan). Two textured crates whose descriptors are pushed into the command buffer with each draw
Push Descriptors
Two crates whose descriptors are pushed into the command buffer with each draw, no descriptor sets (Vulkan only).Descriptor Buffers (TypeScript, Vulkan). Two textured crates whose descriptor sets live in plain buffers the CPU writes
Descriptor Buffers
The same crates, their descriptor sets in buffers the CPU writes descriptors into, no pools (Vulkan only).Hologram (TypeScript, DirectX 12 / Vulkan). 5000 pyramids, icospheres and teapots drifting and blended, their draws recorded by worker threads
Hologram
5000 pyramids, icospheres and teapots drifting and blended, their draws recorded on worker threads into command lists of their own. ### DirectX-Graphics-Samples ports @@ -184,15 +184,15 @@ predecessor, [LunarG VulkanSamples](https://github.com/LunarG/VulkanSamples)). Ported from [Microsoft DirectX-Graphics-Samples](https://github.com/microsoft/DirectX-Graphics-Samples). - + - + - - + +
Raytracing Procedural Geometry (TypeScript, DirectX 12 / Vulkan). Analytic shapes, metaballs, SDFs and a fractal intersected by intersection shaders
Raytracing Procedural Geometry
Analytic shapes, metaballs, SDFs and a fractal intersected by intersection shaders.
Raytracing Opacity Micromaps (TypeScript, DirectX 12 / Vulkan). An alpha-tested tree whose leaves skip the any-hit shader thanks to opacity micromaps (DXR 1.2), baked offline or at run time by the Opacity Micro-Map SDK's GPU baker
Raytracing Opacity Micromaps
An alpha-tested tree whose leaves skip the any-hit shader thanks to opacity micromaps (DXR 1.2), baked offline or at run time (-bake) by the Opacity Micro-Map SDK's GPU baker.
SM6 Wave Intrinsics (TypeScript, DirectX 12 / Vulkan). Wave intrinsics visualized per pixel: lane indices, reductions, prefix sums, quad shuffles
SM6 Wave Intrinsics
Wave intrinsics visualized per pixel: lane indices, reductions, prefix sums, quad shuffles.
Raytracing Procedural Geometry (TypeScript, DirectX 12 / Vulkan). Analytic shapes, metaballs, SDFs and a fractal intersected by intersection shaders
Raytracing Procedural Geometry
Analytic shapes, metaballs, SDFs and a fractal intersected by intersection shaders.
Raytracing Opacity Micromaps (TypeScript, DirectX 12 / Vulkan). An alpha-tested tree whose leaves skip the any-hit shader thanks to opacity micromaps (DXR 1.2), baked offline or at run time by the Opacity Micro-Map SDK's GPU baker
Raytracing Opacity Micromaps
An alpha-tested tree whose leaves skip the any-hit shader thanks to opacity micromaps (DXR 1.2), baked offline or at run time (-bake) by the Opacity Micro-Map SDK's GPU baker.
SM6 Wave Intrinsics (TypeScript, DirectX 12 / Vulkan). Wave intrinsics visualized per pixel: lane indices, reductions, prefix sums, quad shuffles
SM6 Wave Intrinsics
Wave intrinsics visualized per pixel: lane indices, reductions, prefix sums, quad shuffles.
Depth Bounds Test (TypeScript, DirectX 12 / Vulkan). A triangle clipped by an animated depth bounds test
Depth Bounds Test
A triangle clipped by an animated depth bounds test.
Predication Queries (TypeScript, DirectX 12 / Vulkan). A quad drawn only if last frame's occlusion query saw it
Predication Queries
A quad drawn only if last frame's occlusion query saw it.
Small Resources (TypeScript, DirectX 12 / Vulkan). 77 small textures placed at 4 KB alignment vs committed at 64 KB
Small Resources
77 small textures placed at 4 KB alignment vs committed at 64 KB.
Meshlet Render (TypeScript, DirectX 12 / Vulkan). The Stanford dragon drawn by a mesh shader alone, each meshlet in its own color
Meshlet Render
The Stanford dragon drawn by a mesh shader alone, each meshlet in its own color.
Meshlet Cull (TypeScript, DirectX 12 / Vulkan). Amplification shaders cull meshlets by frustum and normal cone; a picked meshlet shows its bounding sphere and cone
Meshlet Cull
Amplification shaders cull meshlets by frustum and normal cone; a picked meshlet shows its bounding sphere and cone.
Meshlet Instancing (TypeScript, DirectX 12 / Vulkan). A cube of toy robots drawn by a mesh shader, several instances of each last meshlet packed into one group
Meshlet Instancing
A cube of toy robots drawn by a mesh shader, several instances of each last meshlet packed into one group.
Dynamic LOD (TypeScript, DirectX 12 / Vulkan). Amplification shaders cull instances and pick one of six levels of detail by screen size
Dynamic LOD
Amplification shaders cull instances and pick one of six levels of detail by screen size.
Execute Indirect (TypeScript, DirectX 12 / Vulkan). A compute shader culls 1024 indirect draw commands; the draw takes their count from a buffer
Execute Indirect
A compute shader culls 1024 indirect draw commands; the draw takes their count from a buffer.
Dynamic Indexing (TypeScript, DirectX 12 / Vulkan). 120 cities, each draw picking its material from an array of 120 textures
Dynamic Indexing
120 cities, each draw picking its material from an array of 120 textures.
HDR Display (TypeScript, DirectX 12 / Vulkan). SDR and HDR gradients and the Rec.709 and Rec.2020 gamuts, presented to 8-bit sRGB, 10-bit ST.2084 or 16-bit scRGB swap chains
HDR Display
SDR and HDR gradients and the Rec.709 / Rec.2020 gamuts on 8-bit sRGB, 10-bit ST.2084 or 16-bit scRGB swap chains.
n-Body Gravity (TypeScript, DirectX 12 / Vulkan). 10000 particles pulling on each other, simulated by a compute shader on the async compute queue and drawn as geometry shader sprites
n-Body Gravity
10,000 particles all pulling on each other: a compute shader on the async compute queue, drawn as geometry shader sprites.
Denoised RTAO (TypeScript, DirectX 12 / Vulkan). Ray traced ambient occlusion at 1 ray per pixel, denoised spatio-temporally, over PBRT scenes and animated grass
Denoised RTAO
Ray traced AO at 1 ray per pixel, denoised spatio-temporally (temporal reprojection, a-trous filter) over PBRT models and animated grass.
HDR Display (TypeScript, DirectX 12 / Vulkan). SDR and HDR gradients and the Rec.709 and Rec.2020 gamuts, presented to 8-bit sRGB, 10-bit ST.2084 or 16-bit scRGB swap chains
HDR Display
SDR and HDR gradients and the Rec.709 / Rec.2020 gamuts on 8-bit sRGB, 10-bit ST.2084 or 16-bit scRGB swap chains.
n-Body Gravity (TypeScript, DirectX 12 / Vulkan). 10000 particles pulling on each other, simulated by a compute shader on the async compute queue and drawn as geometry shader sprites
n-Body Gravity
10,000 particles all pulling on each other: a compute shader on the async compute queue, drawn as geometry shader sprites.
Denoised RTAO (TypeScript, DirectX 12 / Vulkan). Ray traced ambient occlusion at 1 ray per pixel, denoised spatio-temporally, over PBRT scenes and animated grass
Denoised RTAO
Ray traced AO at 1 ray per pixel, denoised spatio-temporally (temporal reprojection, a-trous filter) over PBRT models and animated grass.
Multithreading (TypeScript, DirectX 12 / Vulkan). The SquidRoom scene lit by three moving spotlights with PCF shadows, its 1025 draws recorded on three worker threads
Multithreading
A room of 1025 draws lit by three moving spotlights with PCF shadows, its shadow and scene passes recorded on three worker threads.
Bundles (TypeScript, DirectX 12 / Vulkan). 30 copies of a city drawn with two alternating pipeline states from draws recorded once and replayed every frame
Bundles
30 cities drawn with two alternating pipeline states, from draws recorded once and replayed every frame (D3D12 bundles).
Raytracing Simple Lighting (TypeScript, DirectX 12 / Vulkan). A ray traced cube lit by a point light circling it, its normals interpolated from vertex data read in the closest hit shader
Raytracing Simple Lighting
A ray traced cube lit by a circling point light, the closest hit shader reading its 16-bit indices and vertex normals.
Reserved Resources (TypeScript, DirectX 12 / Vulkan). One level of a tiled texture at a time mapped to memory, picked with the arrow keys
Reserved Resources
One level of a tiled texture at a time mapped to memory, picked with the arrow keys.
Raytracing Library Subobjects (TypeScript, DirectX 12). A ray traced cube whose root signatures, hit group and configs are defined in its HLSL
Raytracing Library Subobjects
A ray traced cube whose root signatures, hit group and configs are defined in its HLSL (D3D12 only).
Generic Programs (TypeScript, DirectX 12). Two triangles drawn with generic programs, graphics pipelines made as state objects
Generic Programs
Two triangles drawn with generic programs: graphics pipelines made as state objects (D3D12 only).
Sakura Forest SER (TypeScript, DirectX 12). A ray traced sakura forest of 13525 instances whose primary rays are reordered with Shader Execution Reordering
Sakura Forest SER
A ray traced sakura forest whose primary rays go through hit objects and Shader Execution Reordering (D3D12 only).
Memory Management (TypeScript, DirectX 12). Large images streamed into video memory a mip level at a time under the memory budget, with mip overlays and a memory graph
Memory Management
Images streamed a mip level at a time under the memory budget: tiled resources, MakeResident / Evict, a paging thread (DirectX 12 only).
Raytracing Hello World (TypeScript, DirectX 12 / Vulkan). One triangle ray traced in screen space, showing the hit barycentrics inside a stencil window
Raytracing Hello World
One triangle ray traced in screen space: hit barycentrics inside a stencil window, dispatch coordinates around it.
Raytracing Hello SER (TypeScript, DirectX 12 / Vulkan). A full screen quad ray traced with hit objects, every fourth column of rays doing extra work and reordered by it
Raytracing Hello SER
Shader Execution Reordering at its simplest: hit objects, threads reordered by a heavy/light work hint (-noreorder to compare).
Partitioned TLAS Dominoes (TypeScript, DirectX 12 preview / Vulkan). A grid of dominoes toppled by GPU physics, a partitioned TLAS updated by instance writes the GPU counts, colored by partition
Partitioned TLAS Dominoes
Dominoes toppled by GPU physics, a partitioned TLAS updated in place by GPU-counted instance writes (or a refitted TLAS), sketch-style compositing. Needs what ptlas needs.
Clustered Geometry (TypeScript, DirectX 12 preview / Vulkan). Glass and chrome spheres, a torus, a cube and a Klein bottle on a glass checker slab, a spiral of clones, every cluster in a color of its own
Clustered Geometry
Objects split into clusters of up to 256 triangles, a CLAS each and a cluster BLAS per object, built by GPU-driven operations; an animated sphere instantiated from cluster templates every frame; per-cluster colors by ClusterID() (shader model 6.10); the sample's traditional-BLAS comparison, COMPRESSED1 vertices, allocation and rebuild modes on keys. D3D12 preview, as ptlas, or Vulkan with VK_NV_cluster_acceleration_structure (FLOAT32_3 vertices only).
Sakura Forest SER (TypeScript, DirectX 12). A ray traced sakura forest of 13525 instances whose primary rays are reordered with Shader Execution Reordering
Sakura Forest SER
A ray traced sakura forest whose primary rays go through hit objects and Shader Execution Reordering (D3D12 only).
Memory Management (TypeScript, DirectX 12). Large images streamed into video memory a mip level at a time under the memory budget, with mip overlays and a memory graph
Memory Management
Images streamed a mip level at a time under the memory budget: tiled resources, MakeResident / Evict, a paging thread (DirectX 12 only).
Raytracing Hello World (TypeScript, DirectX 12 / Vulkan). One triangle ray traced in screen space, showing the hit barycentrics inside a stencil window
Raytracing Hello World
One triangle ray traced in screen space: hit barycentrics inside a stencil window, dispatch coordinates around it.
Raytracing Hello SER (TypeScript, DirectX 12 / Vulkan). A full screen quad ray traced with hit objects, every fourth column of rays doing extra work and reordered by it
Raytracing Hello SER
Shader Execution Reordering at its simplest: hit objects, threads reordered by a heavy/light work hint (-noreorder to compare).
Partitioned TLAS Dominoes (TypeScript, DirectX 12 preview / Vulkan). A grid of dominoes toppled by GPU physics, a partitioned TLAS updated by instance writes the GPU counts, colored by partition
Partitioned TLAS Dominoes
Dominoes toppled by GPU physics, a partitioned TLAS updated in place by GPU-counted instance writes (or a refitted TLAS), sketch-style compositing. Needs what ptlas needs.
Clustered Geometry (TypeScript, DirectX 12 preview / Vulkan). Glass and chrome spheres, a torus, a cube and a Klein bottle on a glass checker slab, a spiral of clones, every cluster in a color of its own
Clustered Geometry
Objects split into clusters of up to 256 triangles, a CLAS each and a cluster BLAS per object, built by GPU-driven operations; an animated sphere instantiated from cluster templates every frame; per-cluster colors by ClusterID() (shader model 6.10); the sample's traditional-BLAS comparison, COMPRESSED1 vertices, allocation and rebuild modes on keys. D3D12 preview, as ptlas, or Vulkan with VK_NV_cluster_acceleration_structure (FLOAT32_3 vertices only).
Raytracing MiniEngine (TypeScript, DirectX 12 / Vulkan). Sponza ray traced: diffuse hit shading with the sun's shadow map, sunlit floor and banners
Raytracing MiniEngine
MiniEngine's Sponza (its sponza.h3d) as a BLAS per mesh and the sample's seven modes on keys 1 to 7: rasterized, barycentrics of primary and reflection rays, shadow rays, diffuse hit shading with shadow maps or shadow rays, reflections. MiniEngine's frame around it too (depth prepass, shadow map, SSAO, its TAA blend and sharpening): every mode matches the sample bit for bit on D3D12; its point lights and particles left out.
@@ -201,10 +201,10 @@ Ported from [Microsoft DirectX-Graphics-Samples](https://github.com/microsoft/Di Ported from [Microsoft Xbox-ATG-Samples](https://github.com/microsoft/Xbox-ATG-Samples). - + - +
Fast Block Compress (TypeScript, DirectX 12 / Vulkan). BC1, BC3 and BC5 texture compression at run time in compute shaders or on the CPU
Fast Block Compress
BC1, BC3 and BC5 texture compression at run time in compute shaders or on the CPU.
Simple HDR (TypeScript, DirectX 12 / Vulkan). HDR10 output (Rec.2020, ST.2084) with blocks brighter than paper white
Simple HDR
HDR10 output (Rec.2020, ST.2084) with blocks brighter than paper white.
Bokeh (TypeScript, DirectX 12 / Vulkan). Depth of field with bokeh sprites expanded by a geometry shader
Bokeh
Depth of field with bokeh sprites expanded by a geometry shader.
Fast Block Compress (TypeScript, DirectX 12 / Vulkan). BC1, BC3 and BC5 texture compression at run time in compute shaders or on the CPU
Fast Block Compress
BC1, BC3 and BC5 texture compression at run time in compute shaders or on the CPU.
Simple HDR (TypeScript, DirectX 12 / Vulkan). HDR10 output (Rec.2020, ST.2084) with blocks brighter than paper white
Simple HDR
HDR10 output (Rec.2020, ST.2084) with blocks brighter than paper white.
Bokeh (TypeScript, DirectX 12 / Vulkan). Depth of field with bokeh sprites expanded by a geometry shader
Bokeh
Depth of field with bokeh sprites expanded by a geometry shader.
Raytracing AO (TypeScript, DirectX 12 / Vulkan). Ray traced ambient occlusion side by side with MiniEngine's SSAO
Raytracing AO
Ray traced ambient occlusion side by side with MiniEngine's SSAO.
Simple PBR (TypeScript, DirectX 12 / Vulkan). Physically based rendering with image based lighting and ACES tone mapping
Simple PBR
Physically based rendering with image based lighting and ACES tone mapping.
Simple Compute (TypeScript, DirectX 12 / Vulkan). A Mandelbrot fractal by a compute shader, synchronous or on the async compute queue
Simple Compute
A Mandelbrot fractal by a compute shader, synchronous or on the async compute queue.
Simple Bezier (TypeScript, DirectX 12 / Vulkan). A Mobius strip of Bezier patches tessellated by hull and domain shaders
Simple Bezier
A Mobius strip of Bezier patches tessellated by hull and domain shaders.
Mouse Cursor (TypeScript, DirectX 12 / Vulkan). Absolute, relative (captured) and custom mouse cursor modes
Mouse Cursor
Absolute, relative (captured) and custom mouse cursor modes.
Collision (TypeScript, DirectX 12 / Vulkan). DirectXMath collision tests between frustums, boxes, spheres, triangles and rays
Collision
DirectXMath collision tests between frustums, boxes, spheres, triangles and rays.
Video Texture (TypeScript, DirectX 12 / Vulkan). A video decoded by Media Foundation into a texture on a spinning cube
Video Texture
A video decoded by Media Foundation into a texture on a spinning cube.
Video Texture (TypeScript, DirectX 12 / Vulkan). A video decoded by Media Foundation into a texture on a spinning cube
Video Texture
A video decoded by Media Foundation into a texture on a spinning cube.
### NVIDIA DXR Tutorials port @@ -326,7 +326,7 @@ motion vectors. and Vulkan), built the same way from a checkout: the sample is under the NVIDIA RTX SDKs License, so nothing of it is copied here. With `-DRTXPT_DIR=` (submodules and assets pulled, and configured once by its own CMake, which downloads the DXC its run-time shader compiler uses) the sample's renderer library, its shaders and -its NRD compile where they are, `core/rtxpt.cpp` drives them and `examples/rtxpt.ts` is the sample's host +its NRD compile where they are, `core/rtxpt.cpp` drives them and `examples/rtxpt/rtxpt.ts` is the sample's host (settings, camera, UI). The `default-rtxpt` and `release-rtxpt` presets build into `build-rtxpt` and `build-release-rtxpt`: @@ -384,7 +384,7 @@ is under the NVIDIA RTX SDKs License too, so it is built the same way: with `-DR and assets pulled, and configured once by its own CMake) its library (`rtxmg`, with OpenSubdiv's `osd_lite` and the demo's environment map) builds from the checkout against this repository's Donut, the demo's shaders compile in place (`shaders/rtxmg_demo.cfg` names them), `core/rtxmg.cpp` drives the library (scene, cluster tessellator, -HiZ, TLAS, environment map sampling) and `examples/rtxmg_demo.ts` is the demo's app (the path tracer's pipeline, +HiZ, TLAS, environment map sampling) and `examples/rtxmg_demo/rtxmg_demo.ts` is the demo's app (the path tracer's pipeline, shader table and bindings, the trace, the blit, the window). The `default-rtxmg` and `release-rtxmg` presets build into `build-rtxmg` and `build-release-rtxmg` (`run_rtxmg.bat` runs the Release build): @@ -424,7 +424,7 @@ D3D12 and Vulkan): the Arcade scene lit only by its emissive triangles, with ReS the NVIDIA RTX SDKs License, so (as with RTXPT) nothing of it is copied here: `-DRTXDI_DIR=` (with its assets pulled) builds the RTXDI runtime library from the checkout (`rtxdi_runtime`), compiles the sample's shaders in place (`shaders/rtxdi_minimal.cfg` names them), `core/rtxdi.cpp` drives the library, `core/rtxdi_minimal.cpp` lays out the -buffers the sample's shaders read, and `core/rtxdi_di.ts` and `examples/rtxdi_minimal.ts` are the sample's host (the +buffers the sample's shaders read, and `examples/rtxdi_minimal/rtxdi_di.ts` and `examples/rtxdi_minimal/rtxdi_minimal.ts` are the sample's host (the light preparation pass, the render pass, the settings window), written in this repository with the sample's values and behaviour. The scene loads from the checkout's `Assets` (linked next to `bin/`) before the first frame, where the sample loads it asynchronously behind a splash screen. A build directory takes either `RTXDI_DIR` or `RTXPT_DIR`, not diff --git a/core/interop/rtxdi_minimal.d.ts b/core/interop/rtxdi_minimal.d.ts index 28e01cdd..ab0f5e82 100644 --- a/core/interop/rtxdi_minimal.d.ts +++ b/core/interop/rtxdi_minimal.d.ts @@ -16,7 +16,7 @@ enum RtxdiBuffer { // The host side of NVIDIA's RTXDI Minimal Sample (github.com/NVIDIA-RTX/RTXDI, Samples/MinimalSample) that // depends on its shaders: the buffers they read and write, the CPU half of the light preparation and the -// resampling constants with the sample's settings; examples/rtxdi_minimal.ts runs the sample's two compute +// resampling constants with the sample's settings; examples/rtxdi_minimal/rtxdi_minimal.ts runs the sample's two compute // shaders on them. Free the resources with Rtxdi_DestroyResources before the app. // The shaders' buffers on the app's device (Donut_GetNvrhiDevice), sized for the scene: the task and light diff --git a/core/interop/rtxmg.d.ts b/core/interop/rtxmg.d.ts index c047dd73..2427bb9f 100644 --- a/core/interop/rtxmg.d.ts +++ b/core/interop/rtxmg.d.ts @@ -39,7 +39,7 @@ @nodrops declare function Donut_RtxmgEndFrame(rtxmgDemo: RtxmgDemoHandle): void; // Writes the blit's constants (ACES tone mapping at exposure) into an open command list. @nodrops declare function Donut_RtxmgWriteBlitParams(rtxmgDemo: RtxmgDemoHandle, openCommandList: CommandListHandle, exposure: number): void; -// A buffer the path tracer or the blit binds (RTXMG_BUFFER_* in examples/rtxmg_demo.ts), a dummy for +// A buffer the path tracer or the blit binds (RTXMG_BUFFER_* in examples/rtxmg_demo/rtxmg_demo.ts), a dummy for // one the scene hasn't; null for an unknown index. @nodrops declare function Donut_RtxmgGetBuffer(rtxmgDemo: RtxmgDemoHandle, which: int): BufferHandle; // A texture they bind (RTXMG_TEXTURE_*): the environment map (black without one) and the outputs. diff --git a/core/interop/rtxpt.d.ts b/core/interop/rtxpt.d.ts index ec7e27bf..d709861a 100644 --- a/core/interop/rtxpt.d.ts +++ b/core/interop/rtxpt.d.ts @@ -50,7 +50,7 @@ // 1 render targets made, 2 passes, 4 acceleration structures. @nodrops declare function Donut_RtxptRendererPrepare(rtxptRenderer: RtxptRendererHandle, width: int, height: int, displayWidth: int, displayHeight: int, needNewPasses: boolean, rebuildAccelStructs: boolean, neeatQualityPreset: int): int; -// Takes the frame's settings (examples/rtxpt.ts's FRAME_SETTINGS_SIZE bytes) and records everything up to the path +// Takes the frame's settings (examples/rtxpt/rtxpt.ts's FRAME_SETTINGS_SIZE bytes) and records everything up to the path // tracing pass. True if the environment map changed: reset the accumulation at the next frame. @nodrops declare function Donut_RtxptRendererBeginFrame(rtxptRenderer: RtxptRendererHandle, commandList: CommandListHandle, frameSettings: Ref): boolean; // The path tracer (the frame settings' samples per pixel): the reference one, or in real-time mode the denoising diff --git a/core/rtxdi_minimal.cpp b/core/rtxdi_minimal.cpp index 5bba61dd..306a75f3 100644 --- a/core/rtxdi_minimal.cpp +++ b/core/rtxdi_minimal.cpp @@ -1,7 +1,7 @@ // C++ glue of the rtxdi_minimal example (NVIDIA's RTXDI Minimal Sample, github.com/NVIDIA-RTX/RTXDI, // Samples/MinimalSample), the part that depends on the sample's shaders: the buffers they read and write, the // CPU half of the light preparation (which emissive geometry's triangles go where in the light buffer) and the -// resampling constants with the sample's settings - for core/rtxdi_di.ts and examples/rtxdi_minimal.ts, which +// resampling constants with the sample's settings - for examples/rtxdi_minimal/rtxdi_di.ts and examples/rtxdi_minimal/rtxdi_minimal.ts, which // create the passes and bind the shaders (RTXDI_DIR's, compiled in place) on them. The structures the shaders // read come from the sample's ShaderParameters.h, included in place (this file's include path, set in // CMakeLists.txt). The values and the behaviour follow the sample's host; the code is this repository's. @@ -45,9 +45,9 @@ static_assert(sizeof(RAB_LightInfo) == 32, "RAB_LightInfo is two uint4s"); static_assert(sizeof(PrepareLightsTask) == 16, "PrepareLightsTask is one uint4"); static_assert(sizeof(PrepareLightsConstants) == 4, "PrepareLightsConstants is one uint"); static_assert(sizeof(ResamplingConstants) % 16 == 0, "ResamplingConstants fills whole constant buffer registers"); -// The ray masks examples/rtxdi_minimal.ts passes to Rtxdi_BuildSceneAccelStructs (core/rtxdi.cpp). +// The ray masks examples/rtxdi_minimal/rtxdi_minimal.ts passes to Rtxdi_BuildSceneAccelStructs (core/rtxdi.cpp). static_assert(INSTANCE_MASK_OPAQUE == 1 && INSTANCE_MASK_ALPHA_TESTED == 2 && INSTANCE_MASK_TRANSPARENT == 4, - "examples/rtxdi_minimal.ts's INSTANCE_MASK_* are the shaders'"); + "examples/rtxdi_minimal/rtxdi_minimal.ts's INSTANCE_MASK_* are the shaders'"); // core/donut_interop.cpp's app and its NVRHI device. struct App; diff --git a/core/rtxpt.cpp b/core/rtxpt.cpp index 6006cbf5..29256d60 100644 --- a/core/rtxpt.cpp +++ b/core/rtxpt.cpp @@ -1,7 +1,7 @@ // C++ glue of the rtxpt example (NVIDIA's RTX Path Tracing sample, github.com/NVIDIA-RTX/RTXPT): the // sample's renderer library (rtxpt_core in CMakeLists.txt: its scene, materials, lights, environment map, // the path tracer's run-time pipeline baker, tone mapping and accumulation, compiled from RTXPT_DIR in -// place) driven for examples/rtxpt.ts, which is the sample's host: what Sample.cpp decides (settings, +// place) driven for examples/rtxpt/rtxpt.ts, which is the sample's host: what Sample.cpp decides (settings, // camera, accumulation, when to rebuild) is there, and RtxptRenderer here holds the sample's C++ objects // and does its steps on them (Sample.cpp's and AdvancedSample.cpp's: the reference mode, and the real-time // mode with its denoising layers, NRD and TAA, or DLSS / DLSS-RR with upscaling; no RTXDI, SHaRC, sub-sampling, @@ -112,7 +112,7 @@ void LocalConfig::PostMaterialLoad(donut::engine::Material&) { } -// What examples/rtxpt.ts decides for a frame, as it writes it (its FS_* offsets): Sample.cpp's m_ui fields +// What examples/rtxpt/rtxpt.ts decides for a frame, as it writes it (its FS_* offsets): Sample.cpp's m_ui fields // and camera that its Render reads. All 4 bytes. struct RtxptFrameSettings { @@ -135,13 +135,13 @@ struct RtxptFrameSettings uint32_t taaEnableHistoryClamping; uint32_t taaUseHistoryClampRelax; float nrdDisocclusionThreshold; float nrdDisocclusionThresholdAlternate; uint32_t nrdUseAlternateDisocclusionThresholdMix; uint32_t samplesPerPixel; }; -static_assert(sizeof(RtxptFrameSettings) == 280, "RtxptFrameSettings: examples/rtxpt.ts's FRAME_SETTINGS_SIZE"); +static_assert(sizeof(RtxptFrameSettings) == 280, "RtxptFrameSettings: examples/rtxpt/rtxpt.ts's FRAME_SETTINGS_SIZE"); static_assert(offsetof(RtxptFrameSettings, apertureRadius) == 48 && offsetof(RtxptFrameSettings, bounceCount) == 64 && offsetof(RtxptFrameSettings, neeEnabled) == 96 && offsetof(RtxptFrameSettings, envMapEnabled) == 128 && offsetof(RtxptFrameSettings, toneMapOperator) == 160 && offsetof(RtxptFrameSettings, bloomIntensity) == 192 && offsetof(RtxptFrameSettings, realtimeMode) == 224 && offsetof(RtxptFrameSettings, resetRealtimeCaches) == 240 && offsetof(RtxptFrameSettings, taaEnableHistoryClamping) == 256 && offsetof(RtxptFrameSettings, nrdUseAlternateDisocclusionThresholdMix) == 272, - "RtxptFrameSettings: examples/rtxpt.ts's FS_* offsets"); + "RtxptFrameSettings: examples/rtxpt/rtxpt.ts's FS_* offsets"); // Sample.cpp's: input 32-bit radiance scaled to fit the baker's 16-bit range. static const float c_envMapRadianceScale = 1.0f / 4.0f; @@ -280,7 +280,7 @@ struct RtxptRenderer // The path tracer's size, and the display's (bigger with DLSS(-RR) upscaling; tone mapping and LdrColor's). uint2 renderSize = { 0, 0 }; uint2 displaySize = { 0, 0 }; - std::vector globalMacros; // examples/rtxpt.ts's (Sample::GetPTPipelineGlobalMacros) + std::vector globalMacros; // examples/rtxpt/rtxpt.ts's (Sample::GetPTPipelineGlobalMacros) nvrhi::BindingSetHandle bindingSet; RtxptFrameSettings settings = {}; @@ -818,7 +818,7 @@ struct RtxptRenderer denoisingGuidesBaker = std::make_shared(device, shaderFactory, renderTargets, shaderDebug, bindingLayout); } - // examples/rtxpt.ts's macros, then the lights baker's (Sample::GetPTPipelineGlobalMacros). + // examples/rtxpt/rtxpt.ts's macros, then the lights baker's (Sample::GetPTPipelineGlobalMacros). void GetGlobalMacros(std::vector& macros) { macros = globalMacros; @@ -1480,7 +1480,7 @@ extern "C" r->SetTogglableNodeSelected(index, shown); } - // The path tracer's global shader macros (Sample::GetPTPipelineGlobalMacros, examples/rtxpt.ts's): cleared, + // The path tracer's global shader macros (Sample::GetPTPipelineGlobalMacros, examples/rtxpt/rtxpt.ts's): cleared, // then added one by one. A change recompiles the path tracer at the next Prepare. DONUT_API void Donut_RtxptRendererClearShaderMacros(RtxptRenderer* r) { @@ -1514,7 +1514,7 @@ extern "C" neeatQualityPreset); } - // The frame's settings (examples/rtxpt.ts's FRAME_SETTINGS_SIZE bytes) and scene time, then everything up + // The frame's settings (examples/rtxpt/rtxpt.ts's FRAME_SETTINGS_SIZE bytes) and scene time, then everything up // to the path tracing pass, recorded into the frame's command list. True if the environment map changed: // reset the accumulation at the next frame. DONUT_API bool Donut_RtxptRendererBeginFrame(RtxptRenderer* r, nvrhi::ICommandList* commandList, const float* frameSettings) diff --git a/core/web_audio.cpp b/core/web_audio.cpp index b5240819..6f5f03ab 100644 --- a/core/web_audio.cpp +++ b/core/web_audio.cpp @@ -1,5 +1,5 @@ // A part of Web Audio, rendered as the specification and Chrome render it, for the Golden Line's -// soundtrack (core/golden_line_sound.ts, a port of a page written for Chrome): gains, biquad filters, +// soundtrack (examples/golden_line/golden_line_sound.ts, a port of a page written for Chrome): gains, biquad filters, // stereo panners, delays (in a cycle too), a dynamics compressor, a wave shaper, a convolver, buffer // sources, oscillators (with a periodic wave) and constant sources; their audio parameters, with // automation events and audio-rate inputs; 128-frame quanta. Realtime (a miniaudio playback device: @@ -12,7 +12,7 @@ // oscillator started within a quantum reading the quantum's parameter values from the first, a cycle // a quantum late at each trip (a node pulled while it renders hands out its last output) and the // compressor's kernel (its detector starting at 0). -// Donut_*WebAudio* (core/interop/web_audio.d.ts; core/web_audio.ts wraps them as WebAudio). +// Donut_*WebAudio* (core/interop/web_audio.d.ts; examples/golden_line/web_audio.ts wraps them as WebAudio). #ifndef NOMINMAX #define NOMINMAX diff --git a/docs/clustered_geometry_vulkan_gpu_faults.md b/docs/clustered_geometry_vulkan_gpu_faults.md index e5380529..96d2a62c 100644 --- a/docs/clustered_geometry_vulkan_gpu_faults.md +++ b/docs/clustered_geometry_vulkan_gpu_faults.md @@ -1,6 +1,6 @@ # ClusteredGeometry on Vulkan: GPU faults (resolved) -`examples/clustered_geometry.ts` (the port of DirectX-Graphics-Samples' D3D12RaytracingClusteredGeometry) runs on +`examples/clustered_geometry/clustered_geometry.ts` (the port of DirectX-Graphics-Samples' D3D12RaytracingClusteredGeometry) runs on D3D12's preview and, since #280, on Vulkan through `VK_NV_cluster_acceleration_structure`. While the Vulkan path was being written, its test runs faulted the GPU twice, badly enough that the second time only a reboot brought the machine back. The cause was an undersized scratch buffer for cluster move operations, fixed in #280. diff --git a/docs/superpowers/plans/2026-11-07-rtxmg-cluster-tess.md b/docs/superpowers/plans/2026-11-07-rtxmg-cluster-tess.md index b752a1c7..6b1456c0 100644 --- a/docs/superpowers/plans/2026-11-07-rtxmg-cluster-tess.md +++ b/docs/superpowers/plans/2026-11-07-rtxmg-cluster-tess.md @@ -6,7 +6,7 @@ **Architecture (RTXCR-style split, chosen 2026-11-07):** - **Native glue `core/rtxmg.cpp`** (in `donut_interop_shared` when `RTXMG_DIR` is set) owns the RTXMG library objects: `RTXMGScene` (load, pose animation, refresh), `ClusterTessellator` + `ClusterTessAccels`, the HiZ `ZBuffer` and its prepass, and the TLAS (instance descs + `fill_instance_descs`). It hands the TypeScript side the TLAS, buffers and descriptor table it binds. -- **TypeScript `examples/rtxmg_demo.ts`** owns the app: args and scene settings, camera, the path tracer pipeline and shader table, its binding sets, accumulation, envmap importance-sampling tables, the blit (expose, ACES, sRGB), `-test`. +- **TypeScript `examples/rtxmg_demo/rtxmg_demo.ts`** owns the app: args and scene settings, camera, the path tracer pipeline and shader table, its binding sets, accumulation, envmap importance-sampling tables, the blit (expose, ACES, sRGB), `-test`. - **Library build:** our CMake adds `${RTXMG_DIR}/rtxmg` and `${RTXMG_DIR}/extern/osd_lite` as subdirectories against our Donut (same commit since PR #290), fetching what RTXMG's root CMake fetches (meshoptimizer v1.1, mimalloc v2.1.7, implot v0.17) and defining the variables its sub-CMake files read (`DONUT_DIR`, `RTXMG_SHADERS_*`, `RTXMG_SHADERMAKE_OPTIONS*`). `rtxmg/CMakeLists.txt` links `envmap` (a `demo/envmap` target): add `${RTXMG_DIR}/demo/envmap` as well. - **Demo shaders** (`rtxmg_demo_path_tracer.hlsl` with `VERTEX_NORMALS=0 CLUSTER_LOD_SHADING=0`, `blit.hlsl`, `lerp_keyframes.hlsl`, `zrender.hlsl`) compile in place via our own `shaders/rtxmg_demo.cfg` with `--sourceDir ${RTXMG_DIR}/demo`, RTXMG's options (`--hlsl2021`, SM 6_6, SPIR-V `--vulkanMemoryLayout scalar -Vd`). @@ -40,7 +40,7 @@ - [ ] Wrappers via `generate_donut_wrappers.py` conventions; donut.ts regenerated, never hand-edited. ### Task 4: TypeScript example, first frame -- [ ] `examples/rtxmg_demo.ts`: Args (`--scene`, `-width`, `-height`, `-frames`, `-test`, `-testOutput`), Vulkan device with ray tracing + cluster extension, bindless layout from the glue, path tracer pipeline (raygen, miss, shadow miss, subd hit group, null shadow hit group, LOD hit groups with dummies), `allowClusters`, accumulation, envmap CDFs (`compute_conditional`, prefix scan, `compute_marginal`), blit. +- [ ] `examples/rtxmg_demo/rtxmg_demo.ts`: Args (`--scene`, `-width`, `-height`, `-frames`, `-test`, `-testOutput`), Vulkan device with ray tracing + cluster extension, bindless layout from the glue, path tracer pipeline (raygen, miss, shadow miss, subd hit group, null shadow hit group, LOD hit groups with dummies), `allowClusters`, accumulation, envmap CDFs (`compute_conditional`, prefix scan, `compute_marginal`), blit. - [ ] `-dx12` exits 77 with the reason. ### Task 5: Match the reference, tests diff --git a/docs/superpowers/plans/2026-11-08-rtxdi-minimal.md b/docs/superpowers/plans/2026-11-08-rtxdi-minimal.md index 403ec1bf..fc1f34ec 100644 --- a/docs/superpowers/plans/2026-11-08-rtxdi-minimal.md +++ b/docs/superpowers/plans/2026-11-08-rtxdi-minimal.md @@ -4,7 +4,7 @@ **Goal:** A tslang example, `rtxdi_minimal`, that ports RTXDI 3.0.0's Minimal Sample (fused single-pass ReSTIR DI on the Arcade) on D3D12 and Vulkan and matches the reference build frame by frame. -**Architecture:** RTXDI (NVIDIA RTX SDKs License) is used in place from a checkout via `RTXDI_DIR`, the `rtxpt` way: its host library compiles as static `rtxdi_runtime`, the Minimal Sample's two HLSL files compile by ShaderMake from `RTXDI_DIR/Samples/MinimalSample/Shaders`. Native glue `core/rtxdi.cpp` owns everything touching RTXDI C++ types or `ShaderParameters.h` layouts (context, resources, light preparation, constant buffers) behind a flat C API typed in `core/interop/rtxdi.d.ts`. TypeScript holds the app: reusable `core/rtxdi_di.ts` (context/resources/light-prep wrappers, render targets) and the minimal frame in `examples/rtxdi_minimal.ts`. +**Architecture:** RTXDI (NVIDIA RTX SDKs License) is used in place from a checkout via `RTXDI_DIR`, the `rtxpt` way: its host library compiles as static `rtxdi_runtime`, the Minimal Sample's two HLSL files compile by ShaderMake from `RTXDI_DIR/Samples/MinimalSample/Shaders`. Native glue `core/rtxdi.cpp` owns everything touching RTXDI C++ types or `ShaderParameters.h` layouts (context, resources, light preparation, constant buffers) behind a flat C API typed in `core/interop/rtxdi.d.ts`. TypeScript holds the app: reusable `examples/rtxdi_minimal/rtxdi_di.ts` (context/resources/light-prep wrappers, render targets) and the minimal frame in `examples/rtxdi_minimal/rtxdi_minimal.ts`. **Tech Stack:** tslang, Donut/NVRHI (D3D12, Vulkan, inline ray queries), RTXDI SDK 3.0.0, CMake/CTest, HLSL via ShaderMake (DXC). @@ -22,7 +22,7 @@ - `core/donut.ts` is generated: `python tools/generate_donut_wrappers.py`, never hand-edited. - tslang bugs go to `I:\TypeScriptCompiler\TSLANG_ISSUES.md` (Open section) with repro and workaround. - Work in a git worktree of branch `rtxdi-minimal` (`superpowers:using-git-worktrees`; memory `worktree-build-setup` for submodules/_deps) — never `git switch` the main checkout `I:\native_ts_graphics`, other sessions share it. -- Commits on branch `rtxdi-minimal`; messages end with `Co-Authored-By: Claude Opus 5.5 `. Never stage the unrelated working-tree files (`core/pbrt_scene.ts`, `core/rtxcr_scene.ts`, `core/rtxmg.ts`, `docs/mimalloc.md`). +- Commits on branch `rtxdi-minimal`; messages end with `Co-Authored-By: Claude Opus 5.5 `. Never stage the unrelated working-tree files (`examples/denoised_rtao/pbrt_scene.ts`, `core/rtxcr_scene.ts`, `examples/rtxmg_demo/rtxmg.ts`, `docs/mimalloc.md`). ## Review Focus @@ -88,12 +88,12 @@ Work in `E:\Gits\RTXDI`. Save the patch as `/rtxdi_minimal_referen ### Task 4: Reusable TS module + PrepareLights pass **Files:** -- Create: `core/rtxdi_di.ts` -- Test: `examples/rtxdi_minimal.ts` (skeleton: loads Arcade synchronously in test mode, builds AS, runs PrepareLights only, test checks) +- Create: `examples/rtxdi_minimal/rtxdi_di.ts` +- Test: `examples/rtxdi_minimal/rtxdi_minimal.ts` (skeleton: loads Arcade synchronously in test mode, builds AS, runs PrepareLights only, test checks) **Interfaces:** - Consumes: Task 3 API. -- Produces (in `core/rtxdi_di.ts`): +- Produces (in `examples/rtxdi_minimal/rtxdi_di.ts`): - `class RtxdiDI { context; resources; constructor(app: App, scene: SceneHandle, width: int, height: int); prepareLights(commandList): int; setFrameIndex(i: int): void; buffer(which: RtxdiBuffer): BufferHandle; dispose(): void }` - `class RtxdiGBuffer { depth; normals; geoNormals; diffuseAlbedo; specularRough; hdrColor; constructor(app: App, width: int, height: int) }` — formats R32_FLOAT, R32_UINT×4, RGBA16_FLOAT as `RenderTargets.cpp`; `class RtxdiRenderTargets { current: RtxdiGBuffer; previous: RtxdiGBuffer; swap(): void }` (check `RenderTargets.cpp` for which textures are doubled and mirror it). - `class PrepareLightsPass { constructor(app, bindlessLayout, scene); createBindingSet(di: RtxdiDI): void; dispatch(commandList, di: RtxdiDI): void }` — bindings as `PrepareLightsPass.cpp` (register numbers from `PrepareLights.hlsl`), shader `rtxdi_minimal/PrepareLights_main`. @@ -102,15 +102,15 @@ Work in `E:\Gits\RTXDI`. Save the patch as `/rtxdi_minimal_referen - [ ] **Step 1: Write the failing test** — skeleton's `-test` check: `Rtxdi_PrepareLights` returned > 0 lights, and the read-back `LightDataBuffer` has every light's `radiance` nonzero and `center` finite (`isFinite32`); `TestCheck` result names the first failing light. - [ ] **Step 2: Run** `build-rtxdi/bin/rtxdi_minimal.exe -dx12 -test`; expected FAIL (pass not implemented). -- [ ] **Step 3:** Implement `core/rtxdi_di.ts` and the skeleton. +- [ ] **Step 3:** Implement `examples/rtxdi_minimal/rtxdi_di.ts` and the skeleton. - [ ] **Step 4: Run** `-dx12 -test -debug` and `-vk -test -debug`; expected PASS, zero validation messages on both (Review Focus 4). - [ ] **Step 5: Commit** `rtxdi_minimal: RTXDI resources and light preparation`. ### Task 5: The Render pass, UI, Args — the full minimal frame **Files:** -- Modify: `examples/rtxdi_minimal.ts`, `core/rtxdi_di.ts` (add `RenderPass`) -- Modify: `CMakeLists.txt` (`add_tslang_example(rtxdi_minimal core/rtxdi_di.ts ${RTXDI_GLUE_SOURCES} MEDIA fonts)`; add `rtxdi_minimal_shaders` dependency; D3D12 needs no Agility for SM 6.5 — don't link it unless the ray query needs it) +- Modify: `examples/rtxdi_minimal/rtxdi_minimal.ts`, `examples/rtxdi_minimal/rtxdi_di.ts` (add `RenderPass`) +- Modify: `CMakeLists.txt` (`add_tslang_example(rtxdi_minimal examples/rtxdi_minimal/rtxdi_di.ts ${RTXDI_GLUE_SOURCES} MEDIA fonts)`; add `rtxdi_minimal_shaders` dependency; D3D12 needs no Agility for SM 6.5 — don't link it unless the ray query needs it) **Interfaces:** - `class RenderPass { constructor(app, bindlessLayout, scene); createBindingSets(tlas: AccelStructHandle, targets: RtxdiRenderTargets, di: RtxdiDI): void; render(commandList, di: RtxdiDI, view: ViewHandle, prevView: ViewHandle, s: RtxdiMinimalSettings, width: int, height: int): void; nextFrame(): void }` — two binding sets (current/previous G-buffer as UAVs t0–t4/u2–u6 per `RAB_Buffers.hlsli`), `nextFrame` swaps them; dispatch `div_ceil(w, RTXDI_SCREEN_SPACE_GROUP_SIZE) × div_ceil(h, ...)` (group size value read from the RTXDI header, as a TS const with a comment). @@ -140,6 +140,6 @@ Work in `E:\Gits\RTXDI`. Save the patch as `/rtxdi_minimal_referen - Modify: `CMakeLists.txt` (tests inside `if (RTXDI_DIR)`), `README.md` (example section + screenshot from a headless dump converted to JPG, credits/license note as rtxpt's) - [ ] **Step 1:** `add_tslang_example_test(rtxdi_minimal ARGS -width 1280 -height 720 -frames 60)` plus `SUFFIX unbiased ARGS ... -unbiased` and `SUFFIX moving ARGS ... -moveCamera 0.01 0 0`; `NO_DEBUG` on vk only if Task 4 Step 4 could not silence the warning (comment why). Run `ctest --test-dir build-rtxdi -R rtxdi_minimal`; expected all pass. -- [ ] **Step 2: JIT:** `tslang --shared-libs=build-rtxdi/bin/donut_interop_shared.dll examples/rtxdi_minimal.ts -- -dx12 -test -dumpFrame 60 -dumpPath /jit.bin -width 1280 -height 720` → bit-identical to the AOT dump (Review Focus 5). +- [ ] **Step 2: JIT:** `tslang --shared-libs=build-rtxdi/bin/donut_interop_shared.dll examples/rtxdi_minimal/rtxdi_minimal.ts -- -dx12 -test -dumpFrame 60 -dumpPath /jit.bin -width 1280 -height 720` → bit-identical to the AOT dump (Review Focus 5). - [ ] **Step 3:** Full `ctest` in `build-rtxdi` (needs the asset dirs per memory `asset-folders-for-full-ctest`); expected no new failures vs main. - [ ] **Step 4: Commit** `rtxdi_minimal: tests and README`; then ask the user before pushing / opening the PR. diff --git a/docs/superpowers/specs/2026-11-08-rtxdi-minimal-design.md b/docs/superpowers/specs/2026-11-08-rtxdi-minimal-design.md index 35b1a3b3..10a1e632 100644 --- a/docs/superpowers/specs/2026-11-08-rtxdi-minimal-design.md +++ b/docs/superpowers/specs/2026-11-08-rtxdi-minimal-design.md @@ -19,7 +19,7 @@ the tag; library submodule `Libraries/Rtxdi` at `d28e20f`). ## Goals -- New example `rtxdi_minimal` (`examples/rtxdi_minimal.ts`) reproducing the Minimal Sample's frame: +- New example `rtxdi_minimal` (`examples/rtxdi_minimal/rtxdi_minimal.ts`) reproducing the Minimal Sample's frame: - loads `Assets/Media/Arcade/Arcade.gltf` from the RTXDI checkout; - the sample's camera: first-person, `LookAt((-1.658, 1.577, 1.69), (-0.9645, 1.2672, 1.0396))`, move speed 3, vertical FOV 60°, reverse-Z infinite projection with near 0.01 @@ -130,7 +130,7 @@ the tag; library submodule `Libraries/Rtxdi` at `d28e20f`). The sample's own C++ (~1.7k lines: `main.cpp`, `PrepareLightsPass`, `RenderPass`, `RtxdiResources`, `RenderTargets`, `SampleScene`, `UserInterface`) is rewritten as our code. -- **TypeScript** (`examples/rtxdi_minimal.ts` + reusable `core/rtxdi_*.ts` modules): app/frame loop, +- **TypeScript** (`examples/rtxdi_minimal/rtxdi_minimal.ts` + reusable `core/rtxdi_*.ts` modules): app/frame loop, camera, view + previous view, UI, Args, render targets (two G-buffer sets ping-ponged), the two passes' pipelines and binding sets, dispatch, blit, test mode. - **C++ glue** (`core/rtxdi.cpp`), *Claude's call*: everything that touches RTXDI's C++ types or the @@ -177,7 +177,7 @@ superset: adds analytic and environment lights), RTXDI resources, render-target reference-verification recipe. What gets replaced: the single fused `Render.hlsl` becomes the Full Sample's multi-pass pipeline (G-buffer pass, initial/temporal/spatial passes, shading, denoisers). So `core/rtxdi_*.ts` holds the reusable parts (context wrapper, resources, light preparation) and -`examples/rtxdi_minimal.ts` only the minimal-specific frame. +`examples/rtxdi_minimal/rtxdi_minimal.ts` only the minimal-specific frame. ## Verification @@ -197,7 +197,7 @@ So `core/rtxdi_*.ts` holds the reusable parts (context wrapper, resources, light - Ref-vs-ref run-to-run variation is measured first, so port differences are judged against it. - ctest: `rtxdi_minimal.dx12`, `rtxdi_minimal.vk` (headless, `test_check.ts` thresholds), only when `RTXDI_DIR` is set. -- JIT run (`tslang --shared-libs=... examples/rtxdi_minimal.ts -- ...`) matches the AOT build. +- JIT run (`tslang --shared-libs=... examples/rtxdi_minimal/rtxdi_minimal.ts -- ...`) matches the AOT build. ## Left to the builder diff --git a/core/clas.ts b/examples/clustered_geometry/clas.ts similarity index 96% rename from core/clas.ts rename to examples/clustered_geometry/clas.ts index 6965e70e..dbc1d329 100644 --- a/core/clas.ts +++ b/examples/clustered_geometry/clas.ts @@ -2,10 +2,11 @@ // // The Clas class, as in donut.ts, over the Donut_* functions core/clas.cpp defines, kept out of // donut.ts (which every example links) for the examples that link core/clas.cpp: import with -// `import { Clas } from "../core/clas";` (from examples/) and list core/clas.ts with core/clas.cpp -// in the example's add_tslang_example sources. +// `import { Clas } from "./clas";` (from examples/clustered_geometry/) and list +// examples/clustered_geometry/clas.ts with core/clas.cpp in the example's add_tslang_example +// sources. -/// +/// @value export class Clas { diff --git a/examples/clustered_geometry.ts b/examples/clustered_geometry/clustered_geometry.ts similarity index 99% rename from examples/clustered_geometry.ts rename to examples/clustered_geometry/clustered_geometry.ts index e46f8e4e..855f5b2b 100644 --- a/examples/clustered_geometry.ts +++ b/examples/clustered_geometry/clustered_geometry.ts @@ -1,14 +1,14 @@ // donut.ts (the class wrappers over donut_interop.d.ts) comes in through input_pass.ts: tslang // would load it twice if this file referenced it too. -import { InputPass } from "../core/input_pass"; -import { Args } from "../core/args"; -import { TestCheck, unsupported } from "../core/test_check"; -import { Clas } from "../core/clas"; -import { formatFixed } from "../core/text_format"; +import { InputPass } from "../../core/input_pass"; +import { Args } from "../../core/args"; +import { TestCheck, unsupported } from "../../core/test_check"; +import { Clas } from "./clas"; +import { formatFixed } from "../../core/text_format"; import { matrixInverse, matrixLookAtLH, matrixMultiply, matrixRotationRollPitchYaw, matrixScaling, matrixTranslation, normalize3, XM_PI, -} from "../core/directx_math"; +} from "../../core/directx_math"; // Port of DirectX-Graphics-Samples' D3D12RaytracingClusteredGeometry: procedural objects decomposed // into clusters of up to 256 triangles, each cluster a CLAS (cluster level acceleration structure) built diff --git a/examples/denoised_rtao.ts b/examples/denoised_rtao/denoised_rtao.ts similarity index 99% rename from examples/denoised_rtao.ts rename to examples/denoised_rtao/denoised_rtao.ts index 3444d571..70a86503 100644 --- a/examples/denoised_rtao.ts +++ b/examples/denoised_rtao/denoised_rtao.ts @@ -1,13 +1,13 @@ // donut.ts (the class wrappers over donut_interop.d.ts) comes in through input_pass.ts: tslang // would load it twice if this file referenced it too. -import { InputPass } from "../core/input_pass"; -import { Args } from "../core/args"; -import { unsupported } from "../core/test_check"; -import { PbrtScene, Images, Rtao } from "../core/pbrt_scene"; +import { InputPass } from "../../core/input_pass"; +import { Args } from "../../core/args"; +import { unsupported } from "../../core/test_check"; +import { PbrtScene, Images, Rtao } from "./pbrt_scene"; import { cross3, matrixInverse, matrixLookAtLH, matrixMultiply, matrixPerspectiveFovLH, matrixRotationY, matrixScaling, matrixTranslation, normalize3, radians, transformCoord3, transformNormal3, vadd, vsub, -} from "../core/directx_math"; +} from "../../core/directx_math"; namespace DenoisedRtao { const WINDOW_TITLE = "D3D12 Raytracing Real-Time Denoised Ambient Occlusion"; diff --git a/core/pbrt_scene.ts b/examples/denoised_rtao/pbrt_scene.ts similarity index 94% rename from core/pbrt_scene.ts rename to examples/denoised_rtao/pbrt_scene.ts index ed74fccc..02ae92ac 100644 --- a/core/pbrt_scene.ts +++ b/examples/denoised_rtao/pbrt_scene.ts @@ -3,10 +3,10 @@ // The classes PbrtScene, Images, Rtao, as in donut.ts, over the Donut_* functions // core/denoised_rtao.cpp defines, kept out of donut.ts (which every example links) for the examples // that link core/denoised_rtao.cpp: import with `import { PbrtScene, Images, Rtao } from -// "../core/pbrt_scene";` (from examples/) and list core/pbrt_scene.ts with core/denoised_rtao.cpp -// in the example's add_tslang_example sources. +// "./pbrt_scene";` (from examples/denoised_rtao/) and list examples/denoised_rtao/pbrt_scene.ts +// with core/denoised_rtao.cpp in the example's add_tslang_example sources. -/// +/// @value export class PbrtScene { @@ -80,7 +80,6 @@ export class PbrtScene { } } -@final export class Images { // Decodes an image file with WIC into 8-bit RGBA, as DirectXTK's WIC texture loader does (its JPEG // decoder differs a little from Donut's): width x height x 4 bytes into dst (Ref of a `let` int @@ -90,7 +89,6 @@ export class Images { } } -@final export class Rtao { // The sample's RTAO sample sets: numSampleSets sets of samplesPerSet multi-jittered samples on the // cosine-weighted hemisphere (its Samplers::MultiJittered, seeded with 1729), in the order the diff --git a/examples/fast_block_compress.ts b/examples/fast_block_compress/fast_block_compress.ts similarity index 99% rename from examples/fast_block_compress.ts rename to examples/fast_block_compress/fast_block_compress.ts index c7cbbafa..c5909216 100644 --- a/examples/fast_block_compress.ts +++ b/examples/fast_block_compress/fast_block_compress.ts @@ -1,10 +1,10 @@ // donut.ts (the class wrappers over donut_interop.d.ts) comes in through input_pass.ts: tslang // would load it twice if this file referenced it too. -import { InputPass } from "../core/input_pass"; -import { Args } from "../core/args"; -import { TestCheck } from "../core/test_check"; -import { FbcTexture } from "../core/fbc_texture"; -import { comboItems } from "../core/text_format"; +import { InputPass } from "../../core/input_pass"; +import { Args } from "../../core/args"; +import { TestCheck } from "../../core/test_check"; +import { FbcTexture } from "./fbc_texture"; +import { comboItems } from "../../core/text_format"; namespace FastBlockCompress { // Test mode: the frames rendered. diff --git a/core/fbc_texture.ts b/examples/fast_block_compress/fbc_texture.ts similarity index 90% rename from core/fbc_texture.ts rename to examples/fast_block_compress/fbc_texture.ts index ec9ae7a2..0849cfd1 100644 --- a/core/fbc_texture.ts +++ b/examples/fast_block_compress/fbc_texture.ts @@ -2,11 +2,11 @@ // // The FbcTexture class, as in donut.ts, over the Donut_* functions core/fast_block_compress.cpp // defines, kept out of donut.ts (which every example links) for the examples that link -// core/fast_block_compress.cpp: import with `import { FbcTexture } from "../core/fbc_texture";` -// (from examples/) and list core/fbc_texture.ts with core/fast_block_compress.cpp in the example's -// add_tslang_example sources. +// core/fast_block_compress.cpp: import with `import { FbcTexture } from "./fbc_texture";` (from +// examples/fast_block_compress/) and list examples/fast_block_compress/fbc_texture.ts with +// core/fast_block_compress.cpp in the example's add_tslang_example sources. -/// +/// @value export class FbcTexture { diff --git a/examples/golden_line.ts b/examples/golden_line/golden_line.ts similarity index 98% rename from examples/golden_line.ts rename to examples/golden_line/golden_line.ts index 8c776964..8e878700 100644 --- a/examples/golden_line.ts +++ b/examples/golden_line/golden_line.ts @@ -1,41 +1,41 @@ // donut.ts (the class wrappers over donut_interop.d.ts) comes in through input_pass.ts: tslang // would load it twice if this file referenced it too. -import { InputPass } from "../core/input_pass"; -import { Args } from "../core/args"; -import { TestCheck } from "../core/test_check"; +import { InputPass } from "../../core/input_pass"; +import { Args } from "../../core/args"; +import { TestCheck } from "../../core/test_check"; import { World, NoiseTextures, NOISE_SIZE, SEED, CHUNK_LEN, ORIGIN_STEP, START_Z, SUN_AZIMUTH, linearFromHex, lerp, smoothstep, deg, -} from "../core/golden_line_world"; -import { TreeRenderer, VEG_CLEAR_NONE, VEG_CLEAR_BRIDGE, VEG_CLEAR_TRACKSIDE, VEG_CLEAR_DRONE } from "../core/golden_line_vegetation"; -import { WaterRenderer } from "../core/golden_line_water"; -import { GrassRenderer } from "../core/golden_line_grass"; -import { TrainRenderer, TRN_CAMERA_COACH } from "../core/golden_line_train"; -import { StructuresRenderer } from "../core/golden_line_structures"; -import { SunShadows, SH_CASCADES } from "../core/golden_line_shadows"; -import { Steam, SteamLight } from "../core/golden_line_steam"; -import { Motes } from "../core/golden_line_motes"; -import { Bloom } from "../core/golden_line_bloom"; -import { Cameraman, ShotContext, ShotOptions, ShotPose, SHOT_NAMES, shTrainLength, SHOT_DRONE, SHOT_TRACKSIDE, SHOT_BRIDGE, SHOT_INTERIOR, SHOT_TUNNEL, SHOT_CAB } from "../core/golden_line_shots"; -import { Birds } from "../core/golden_line_birds"; -import { Hud, HUD_SOUND_NONE, HUD_SOUND_ON, HUD_SOUND_OFF } from "../core/golden_line_hud"; -import { Sound, SoundFrame, SOUND_NONE, SOUND_OFF } from "../core/golden_line_sound"; +} from "./golden_line_world"; +import { TreeRenderer, VEG_CLEAR_NONE, VEG_CLEAR_BRIDGE, VEG_CLEAR_TRACKSIDE, VEG_CLEAR_DRONE } from "./golden_line_vegetation"; +import { WaterRenderer } from "./golden_line_water"; +import { GrassRenderer } from "./golden_line_grass"; +import { TrainRenderer, TRN_CAMERA_COACH } from "./golden_line_train"; +import { StructuresRenderer } from "./golden_line_structures"; +import { SunShadows, SH_CASCADES } from "./golden_line_shadows"; +import { Steam, SteamLight } from "./golden_line_steam"; +import { Motes } from "./golden_line_motes"; +import { Bloom } from "./golden_line_bloom"; +import { Cameraman, ShotContext, ShotOptions, ShotPose, SHOT_NAMES, shTrainLength, SHOT_DRONE, SHOT_TRACKSIDE, SHOT_BRIDGE, SHOT_INTERIOR, SHOT_TUNNEL, SHOT_CAB } from "./golden_line_shots"; +import { Birds } from "./golden_line_birds"; +import { Hud, HUD_SOUND_NONE, HUD_SOUND_ON, HUD_SOUND_OFF } from "./golden_line_hud"; +import { Sound, SoundFrame, SOUND_NONE, SOUND_OFF } from "./golden_line_sound"; // The Golden Line's ground and sky: an endless line through European-style countryside at golden // hour, from golden-line (github.com/StarKnightt/golden-line, MIT License, Copyright (c) 2026 // Prasenjit (StarKnightt)), a three.js WebGPU page. Its world is generated on the CPU as the -// original's is (core/golden_line_world.ts, the same arrays to the last bit); its node materials are +// original's is (examples/golden_line/golden_line_world.ts, the same arrays to the last bit); its node materials are // HLSL here (shaders/golden_line.hlsl, golden_line_trees.hlsl). Its trees are planted, grown and -// textured as the original's are (core/golden_line_trees.ts, golden_line_treegen.ts, -// golden_line_textures.ts) and culled and drawn on the GPU (core/golden_line_vegetation.ts); its lakes -// and rivers too (core/golden_line_water.ts, shaders/golden_line_water.hlsl), with the planar mirror +// textured as the original's are (examples/golden_line/golden_line_trees.ts, golden_line_treegen.ts, +// golden_line_textures.ts) and culled and drawn on the GPU (examples/golden_line/golden_line_vegetation.ts); its lakes +// and rivers too (examples/golden_line/golden_line_water.ts, shaders/golden_line_water.hlsl), with the planar mirror // the original gives the one body that fills most of the view; and its wheat, grass, wildflowers and -// reeds (core/golden_line_grass.ts, shaders/golden_line_grass.hlsl); and its train, the engine, tender and -// five coaches running on the line (core/golden_line_train.ts, golden_line_loco.ts, golden_line_tender.ts, +// reeds (examples/golden_line/golden_line_grass.ts, shaders/golden_line_grass.hlsl); and its train, the engine, tender and +// five coaches running on the line (examples/golden_line/golden_line_train.ts, golden_line_loco.ts, golden_line_tender.ts, // golden_line_coach.ts, shaders/golden_line_train.hlsl; -trainz puts its front buffer at z), with the // footplate and its crew (golden_line_cab.ts) and the furnished saloon of the camera coach // (golden_line_saloon.ts, shaders/golden_line_interior.hlsl); and beside the line its permanent way and -// lineside (core/golden_line_structures.ts, golden_line_trackway.ts, golden_line_lineside.ts, +// lineside (examples/golden_line/golden_line_structures.ts, golden_line_trackway.ts, golden_line_lineside.ts, // shaders/golden_line_structures.hlsl): ballast, rails and sleepers, telegraph poles and wires, fences, // quarter-mile posts, bales, dry-stone walls and the outlying farms (golden_line_houses.ts); the viaducts // and river bridges (golden_line_bridges.ts); and the tunnels, their portals and planting, lit inside by diff --git a/core/golden_line_bake.ts b/examples/golden_line/golden_line_bake.ts similarity index 100% rename from core/golden_line_bake.ts rename to examples/golden_line/golden_line_bake.ts diff --git a/core/golden_line_birds.ts b/examples/golden_line/golden_line_birds.ts similarity index 99% rename from core/golden_line_birds.ts rename to examples/golden_line/golden_line_birds.ts index 5af1d996..71da94c8 100644 --- a/core/golden_line_birds.ts +++ b/examples/golden_line/golden_line_birds.ts @@ -9,9 +9,9 @@ // show a shape fade out, and none is drawn across the train. The flocks fly on the CPU (in the original's // order of random draws, with its fdlibm trigonometry); shaders/golden_line_birds.hlsl beats the wings. // -// Imported with `import { Birds } from "../core/golden_line_birds";` (from examples/). +// Imported with `import { Birds } from "./golden_line_birds";` (from examples/). -import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc } from "./donut"; +import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc } from "../../core/donut"; import { World, smoothstep, lerp, hypot2 } from "./golden_line_world"; import { skSin, skCos, skAtan, skAtan2, skAsin, skTan } from "./golden_line_structkit"; diff --git a/core/golden_line_bloom.ts b/examples/golden_line/golden_line_bloom.ts similarity index 99% rename from core/golden_line_bloom.ts rename to examples/golden_line/golden_line_bloom.ts index 910b2ad7..ee0a0833 100644 --- a/core/golden_line_bloom.ts +++ b/examples/golden_line/golden_line_bloom.ts @@ -9,9 +9,9 @@ // in the dark of a tunnel lowers the threshold and widens the glow, so the daylight beyond a mouth spills // over the arch (setGlare). // -// Imported with `import { Bloom } from "../core/golden_line_bloom";` (from examples/). +// Imported with `import { Bloom } from "./golden_line_bloom";` (from examples/). -import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, Frame, GraphicsPipelineDesc } from "./donut"; +import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, Frame, GraphicsPipelineDesc } from "../../core/donut"; import { skExp } from "./golden_line_structkit"; const BL_MIPS: int = 5; diff --git a/core/golden_line_bridgekit.ts b/examples/golden_line/golden_line_bridgekit.ts similarity index 100% rename from core/golden_line_bridgekit.ts rename to examples/golden_line/golden_line_bridgekit.ts diff --git a/core/golden_line_bridges.ts b/examples/golden_line/golden_line_bridges.ts similarity index 100% rename from core/golden_line_bridges.ts rename to examples/golden_line/golden_line_bridges.ts diff --git a/core/golden_line_cab.ts b/examples/golden_line/golden_line_cab.ts similarity index 100% rename from core/golden_line_cab.ts rename to examples/golden_line/golden_line_cab.ts diff --git a/core/golden_line_coach.ts b/examples/golden_line/golden_line_coach.ts similarity index 100% rename from core/golden_line_coach.ts rename to examples/golden_line/golden_line_coach.ts diff --git a/core/golden_line_extrude.ts b/examples/golden_line/golden_line_extrude.ts similarity index 99% rename from core/golden_line_extrude.ts rename to examples/golden_line/golden_line_extrude.ts index a196a709..0792d0c7 100644 --- a/core/golden_line_extrude.ts +++ b/examples/golden_line/golden_line_extrude.ts @@ -9,7 +9,7 @@ // The ports keep three's operation order, so they reproduce its triangles and (after the float32 rounding // three's Float32BufferAttributes apply, done here too) its vertex data. // -// Imported with `import { ... } from "../core/golden_line_extrude";` (from examples/). +// Imported with `import { ... } from "./golden_line_extrude";` (from examples/). // --- Small helpers (tslang's Math.max/min mishandle some inputs, so use plain comparisons) ------------- diff --git a/core/golden_line_grass.ts b/examples/golden_line/golden_line_grass.ts similarity index 99% rename from core/golden_line_grass.ts rename to examples/golden_line/golden_line_grass.ts index b2282bfc..68493b92 100644 --- a/core/golden_line_grass.ts +++ b/examples/golden_line/golden_line_grass.ts @@ -1,16 +1,16 @@ // The Golden Line's grass, wheat, wildflowers and reeds on the GPU: a port of golden-line's // src/vegetation/grass.js, grass-geometry.js, reeds.js and chunk.js's buildGround // (github.com/StarKnightt/golden-line, MIT License, Copyright (c) 2026 Prasenjit (StarKnightt)). The -// atlas comes from core/golden_line_textures.ts; the shaders are shaders/golden_line_grass.hlsl. +// atlas comes from examples/golden_line/golden_line_textures.ts; the shaders are shaders/golden_line_grass.hlsl. // // A sliding window of the chunks' ground data (height, crop masks, colour) sits in storage buffers; each // frame a compute pass walks three rings of world-fixed candidate cells around the camera and appends // the survivors to indirect draw lists. The reeds are planted along the shallows of every water body // and the clumps near the camera copied into one instanced draw when the camera has moved a few metres. // -// Imported with `import { GrassRenderer } from "../core/golden_line_grass";` (from examples/). +// Imported with `import { GrassRenderer } from "./golden_line_grass";` (from examples/). -import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc, InputLayoutDesc } from "./donut"; +import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc, InputLayoutDesc } from "../../core/donut"; import { World, TerrainMesh, GroundSample, Rng, smoothstep, toInt32, hypot2, CHUNK_LEN, NO_WATER, LINE_GROUND, } from "./golden_line_world"; diff --git a/core/golden_line_houses.ts b/examples/golden_line/golden_line_houses.ts similarity index 100% rename from core/golden_line_houses.ts rename to examples/golden_line/golden_line_houses.ts diff --git a/core/golden_line_hud.ts b/examples/golden_line/golden_line_hud.ts similarity index 99% rename from core/golden_line_hud.ts rename to examples/golden_line/golden_line_hud.ts index f912afda..a5716145 100644 --- a/core/golden_line_hud.ts +++ b/examples/golden_line/golden_line_hud.ts @@ -14,9 +14,9 @@ // finished frame in its sRGB-encoded values, as the page blends them, taking the blit's place. (The back // buffer is SRGBA8, so ImGui's words get their colours linearized: they are stored as the page's.) // -// Imported with `import { Hud, HudRide } from "../core/golden_line_hud";` (from examples/). +// Imported with `import { Hud, HudRide } from "./golden_line_hud";` (from examples/). -import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc, ImGui, ImGuiFont, ImGuiPass } from "./donut"; +import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc, ImGui, ImGuiFont, ImGuiPass } from "../../core/donut"; import { World, SEG_TOWN } from "./golden_line_world"; // ---------------------------------------------------------------- hud.js: what the HUD says diff --git a/core/golden_line_lineside.ts b/examples/golden_line/golden_line_lineside.ts similarity index 100% rename from core/golden_line_lineside.ts rename to examples/golden_line/golden_line_lineside.ts diff --git a/core/golden_line_loco.ts b/examples/golden_line/golden_line_loco.ts similarity index 100% rename from core/golden_line_loco.ts rename to examples/golden_line/golden_line_loco.ts diff --git a/core/golden_line_motes.ts b/examples/golden_line/golden_line_motes.ts similarity index 98% rename from core/golden_line_motes.ts rename to examples/golden_line/golden_line_motes.ts index cdd4e348..777b929e 100644 --- a/core/golden_line_motes.ts +++ b/examples/golden_line/golden_line_motes.ts @@ -6,9 +6,9 @@ // that the ray leaves through a window opening on that side, so the specks trace the same slanted shafts as // the sun on the seats. Seen only from the window seat (frame.interior), additive, after the steam. // -// Imported with `import { Motes, MoteView } from "../core/golden_line_motes";` (from examples/). +// Imported with `import { Motes, MoteView } from "./golden_line_motes";` (from examples/). -import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc } from "./donut"; +import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc } from "../../core/donut"; import { smoothstep, lerp, hypot3 } from "./golden_line_world"; import { COACH_INNER_HALF, COACH_FLOOR_Y, COACH_CANTRAIL_Y, COACH_WINDOW_CENTRES } from "./golden_line_wheels"; diff --git a/core/golden_line_plume.ts b/examples/golden_line/golden_line_plume.ts similarity index 99% rename from core/golden_line_plume.ts rename to examples/golden_line/golden_line_plume.ts index 1c5cd498..5648f0f4 100644 --- a/core/golden_line_plume.ts +++ b/examples/golden_line/golden_line_plume.ts @@ -13,7 +13,7 @@ // frame.aerialShot: the shot is the drone chase or a still (-eye) camera (the original's shotId 'drone' or // 'inspect'), from which the swollen tail of the plume is seen. // -// Imported with `import { Plume, PlumeFrame } from "../core/golden_line_plume";` (from examples/). +// Imported with `import { Plume, PlumeFrame } from "./golden_line_plume";` (from examples/). import { World, Track, SEG_TUNNEL, Rng, smoothstep, saturate, lerp, hypot2, hypot3, toInt32 } from "./golden_line_world"; import { skSin, skCos, skExp } from "./golden_line_structkit"; diff --git a/core/golden_line_portal.ts b/examples/golden_line/golden_line_portal.ts similarity index 100% rename from core/golden_line_portal.ts rename to examples/golden_line/golden_line_portal.ts diff --git a/core/golden_line_puffs.ts b/examples/golden_line/golden_line_puffs.ts similarity index 99% rename from core/golden_line_puffs.ts rename to examples/golden_line/golden_line_puffs.ts index a9f5705a..db41aa4f 100644 --- a/core/golden_line_puffs.ts +++ b/examples/golden_line/golden_line_puffs.ts @@ -8,7 +8,7 @@ // ("six-way lighting"), so a flat card shades like a solid mass. Atlas A: light from +X, +Y, -X, -Y; // atlas B: from the front, from behind, coverage, thickness. Both carry their full mip chains. -import { App, BindingLayoutDesc, BindingSetDesc, CommandList } from "./donut"; +import { App, BindingLayoutDesc, BindingSetDesc, CommandList } from "../../core/donut"; import { Rng } from "./golden_line_world"; export const PF_ATLAS_COLS: int = 4; diff --git a/core/golden_line_saloon.ts b/examples/golden_line/golden_line_saloon.ts similarity index 99% rename from core/golden_line_saloon.ts rename to examples/golden_line/golden_line_saloon.ts index 92f1f902..d33752d4 100644 --- a/core/golden_line_saloon.ts +++ b/examples/golden_line/golden_line_saloon.ts @@ -5,7 +5,7 @@ // Built to the COACH constants that the window-seat camera relies on: mahogany and marquetry, pairs of // winged velvet armchairs either side of every window with a table between, silk-shaded lamps, brass racks, // old-gold curtains and a cream vaulted ceiling. Everything is in the coach's local frame. Daylight and -// lamplight are baked per vertex (core/golden_line_bake.ts). +// lamplight are baked per vertex (examples/golden_line/golden_line_bake.ts). // // shadowProxy, saloon.js's low-poly shadow caster for the furniture, is buildSaloonShadow: it feeds the // shadow maps. diff --git a/core/golden_line_shadowfit.ts b/examples/golden_line/golden_line_shadowfit.ts similarity index 100% rename from core/golden_line_shadowfit.ts rename to examples/golden_line/golden_line_shadowfit.ts diff --git a/core/golden_line_shadows.ts b/examples/golden_line/golden_line_shadows.ts similarity index 98% rename from core/golden_line_shadows.ts rename to examples/golden_line/golden_line_shadows.ts index 186e65fc..ed5201e2 100644 --- a/core/golden_line_shadows.ts +++ b/examples/golden_line/golden_line_shadows.ts @@ -4,7 +4,7 @@ // 750 m margin toward the sun for the long low-sun shadows) and their 2048-texel depth maps. The shaders // sample them through shaders/golden_line_shadow.hlsli, bound in register space 1. -import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList } from "./donut"; +import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList } from "../../core/donut"; import { ShadowFit, SH_CASCADES, SH_SIZE, SH_FLOATS } from "./golden_line_shadowfit"; export { ShadowFit, SH_CASCADES, SH_SIZE } from "./golden_line_shadowfit"; diff --git a/core/golden_line_shots.ts b/examples/golden_line/golden_line_shots.ts similarity index 99% rename from core/golden_line_shots.ts rename to examples/golden_line/golden_line_shots.ts index e0f37c3a..5aeaffa9 100644 --- a/core/golden_line_shots.ts +++ b/examples/golden_line/golden_line_shots.ts @@ -12,7 +12,7 @@ // frame by frame at 60 Hz, as the original's composeNow steps it). The director (cutting between shots on // its own, sending the train down the line) is not ported yet. // -// Imported with `import { Cameraman, ShotOptions, ShotPose, SHOT_DRONE, ... } from "../core/golden_line_shots";`. +// Imported with `import { Cameraman, ShotOptions, ShotPose, SHOT_DRONE, ... } from "./golden_line_shots";`. import { World, Track, Terrain, Rng, Biome, Feature, hashFloat, hypot2, hypot3, lerp, smoothstep, saturate, diff --git a/core/golden_line_signs.ts b/examples/golden_line/golden_line_signs.ts similarity index 100% rename from core/golden_line_signs.ts rename to examples/golden_line/golden_line_signs.ts diff --git a/core/golden_line_sound.ts b/examples/golden_line/golden_line_sound.ts similarity index 100% rename from core/golden_line_sound.ts rename to examples/golden_line/golden_line_sound.ts diff --git a/core/golden_line_soundbank.ts b/examples/golden_line/golden_line_soundbank.ts similarity index 100% rename from core/golden_line_soundbank.ts rename to examples/golden_line/golden_line_soundbank.ts diff --git a/core/golden_line_station.ts b/examples/golden_line/golden_line_station.ts similarity index 100% rename from core/golden_line_station.ts rename to examples/golden_line/golden_line_station.ts diff --git a/core/golden_line_steam.ts b/examples/golden_line/golden_line_steam.ts similarity index 99% rename from core/golden_line_steam.ts rename to examples/golden_line/golden_line_steam.ts index 73082260..7b7d5128 100644 --- a/core/golden_line_steam.ts +++ b/examples/golden_line/golden_line_steam.ts @@ -11,9 +11,9 @@ // As the engine breaks out of a bore the tunnel take opens the eye wide (SteamLight.dazzle, its extra // exposure): the steam then takes back about half of it, so that it glows and still shows its billows. // -// Imported with `import { Steam, SteamLight } from "../core/golden_line_steam";` (from examples/). +// Imported with `import { Steam, SteamLight } from "./golden_line_steam";` (from examples/). -import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc } from "./donut"; +import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc } from "../../core/donut"; import { World, smoothstep, lerp, LINE_TUNNEL } from "./golden_line_world"; import { SteamTextures } from "./golden_line_puffs"; import { skExp } from "./golden_line_structkit"; diff --git a/core/golden_line_structkit.ts b/examples/golden_line/golden_line_structkit.ts similarity index 100% rename from core/golden_line_structkit.ts rename to examples/golden_line/golden_line_structkit.ts diff --git a/core/golden_line_structures.ts b/examples/golden_line/golden_line_structures.ts similarity index 99% rename from core/golden_line_structures.ts rename to examples/golden_line/golden_line_structures.ts index 7e949615..f5f5bef3 100644 --- a/core/golden_line_structures.ts +++ b/examples/golden_line/golden_line_structures.ts @@ -13,7 +13,7 @@ // // Not ported yet: structure shadows (the port has no shadow maps). -import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc, InputLayoutDesc } from "./donut"; +import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc, InputLayoutDesc } from "../../core/donut"; import { World, TerrainMesh, Terrain, smoothstep, hypot2, CHUNK_LEN, SEG_TUNNEL, SEG_VIADUCT, SEG_RIVER, SEG_TOWN, LINE_TUNNEL } from "./golden_line_world"; import { buildBridge } from "./golden_line_bridges"; import { buildLining, TN_STRIDE } from "./golden_line_tunnel"; diff --git a/core/golden_line_surfaces.ts b/examples/golden_line/golden_line_surfaces.ts similarity index 99% rename from core/golden_line_surfaces.ts rename to examples/golden_line/golden_line_surfaces.ts index e56f5119..4a6df9fa 100644 --- a/core/golden_line_surfaces.ts +++ b/examples/golden_line/golden_line_surfaces.ts @@ -1,6 +1,6 @@ // golden-line's procedural surfaces of built things (createSurfaceTextures in src/structures/textures.js), // ported to tslang. -// golden-line (MIT): see examples/golden_line.ts. +// golden-line (MIT): see examples/golden_line/golden_line.ts. // // Eight layers (ashlar, brick, slate, pantile, ballast, paving, plaster, timber) of SURF_SIZE^2 texels, // baked once into two RGBA8 texture arrays, so every built thing samples the same two textures: diff --git a/core/golden_line_tender.ts b/examples/golden_line/golden_line_tender.ts similarity index 100% rename from core/golden_line_tender.ts rename to examples/golden_line/golden_line_tender.ts diff --git a/core/golden_line_textures.ts b/examples/golden_line/golden_line_textures.ts similarity index 99% rename from core/golden_line_textures.ts rename to examples/golden_line/golden_line_textures.ts index bdbe5d28..aeab166b 100644 --- a/core/golden_line_textures.ts +++ b/examples/golden_line/golden_line_textures.ts @@ -1,5 +1,5 @@ // golden-line's vegetation textures (src/vegetation/textures.js and atlas.js), ported to tslang. -// golden-line (MIT): see examples/golden_line.ts. +// golden-line (MIT): see examples/golden_line/golden_line.ts. // // Every texture is painted in code. The bark and the coverage-preserving mip chains are pure arithmetic // and match the original. The foliage atlas was painted with a browser's 2D canvas; here a small diff --git a/core/golden_line_trackway.ts b/examples/golden_line/golden_line_trackway.ts similarity index 100% rename from core/golden_line_trackway.ts rename to examples/golden_line/golden_line_trackway.ts diff --git a/core/golden_line_train.ts b/examples/golden_line/golden_line_train.ts similarity index 99% rename from core/golden_line_train.ts rename to examples/golden_line/golden_line_train.ts index a935f136..22f47e7d 100644 --- a/core/golden_line_train.ts +++ b/examples/golden_line/golden_line_train.ts @@ -1,13 +1,13 @@ // The Golden Line's train on the GPU: a port of golden-line's src/train/index.js, consist.js (motion), // ground.js and spill.js (github.com/StarKnightt/golden-line, MIT License, Copyright (c) 2026 Prasenjit // (StarKnightt)). The vehicles' meshes come from core/golden_line_{loco,tender,coach}.ts (built with -// core/golden_line_traingeo.ts and _wheels.ts), the footplate and its crew from _cab.ts, the furnished +// examples/golden_line/golden_line_traingeo.ts and _wheels.ts), the footplate and its crew from _cab.ts, the furnished // saloon of the camera coach from _saloon.ts (its light baked per vertex by _bake.ts); the shaders are // shaders/golden_line_train.hlsl (outside) and golden_line_interior.hlsl (inside). // -// Imported with `import { TrainRenderer } from "../core/golden_line_train";` (from examples/). +// Imported with `import { TrainRenderer } from "./golden_line_train";` (from examples/). -import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc, InputLayoutDesc } from "./donut"; +import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc, InputLayoutDesc } from "../../core/donut"; import { World, Track, TerrainMesh, terrainColumns, SEG_TUNNEL, SEG_VIADUCT, SEG_RIVER } from "./golden_line_world"; import { Bucket, CH_COLOR, CH_SURF, CH_PANEL, CH_UV, CH_GL } from "./golden_line_traingeo"; import { diff --git a/core/golden_line_traingeo.ts b/examples/golden_line/golden_line_traingeo.ts similarity index 99% rename from core/golden_line_traingeo.ts rename to examples/golden_line/golden_line_traingeo.ts index 0aefe9dc..5ddf5bb2 100644 --- a/core/golden_line_traingeo.ts +++ b/examples/golden_line/golden_line_traingeo.ts @@ -2,7 +2,7 @@ // (github.com/StarKnightt/golden-line, MIT License, Copyright (c) 2026 Prasenjit (StarKnightt)), with the // three.js r187 primitives it leans on (BoxGeometry, RoundedBoxGeometry, SphereGeometry, TorusGeometry, // MIT License, Copyright (c) 2010-2025 three.js authors) ported alongside so the meshes come out the same. -// Extrusions, tubes and polygon triangulation live in core/golden_line_extrude.ts. +// Extrusions, tubes and polygon triangulation live in examples/golden_line/golden_line_extrude.ts. // // Parts are raw indexed triangles (CCW seen from outside); buckets merge parts with per-vertex material data. diff --git a/core/golden_line_treegen.ts b/examples/golden_line/golden_line_treegen.ts similarity index 99% rename from core/golden_line_treegen.ts rename to examples/golden_line/golden_line_treegen.ts index 399dcc51..4a8dff25 100644 --- a/core/golden_line_treegen.ts +++ b/examples/golden_line/golden_line_treegen.ts @@ -1,5 +1,5 @@ // golden-line's tree prototypes (src/vegetation/treegen.js), ported to tslang. -// golden-line (MIT): see examples/golden_line.ts. +// golden-line (MIT): see examples/golden_line/golden_line.ts. // // Each prototype is grown once as tubes (trunk and limbs) and foliage cards, then emitted as a near // mesh (bark and leaves apart) and a mid mesh (one merged mesh with fewer, larger cards), plus the diff --git a/core/golden_line_trees.ts b/examples/golden_line/golden_line_trees.ts similarity index 99% rename from core/golden_line_trees.ts rename to examples/golden_line/golden_line_trees.ts index 27f529a1..13bfc74f 100644 --- a/core/golden_line_trees.ts +++ b/examples/golden_line/golden_line_trees.ts @@ -1,5 +1,5 @@ // Where golden-line's trees stand (src/world/chunk.js's buildTrees), ported to tslang. -// golden-line (MIT): see examples/golden_line.ts. +// golden-line (MIT): see examples/golden_line/golden_line.ts. // // Every chunk plants woodland on jittered grids, scrub, hedgerows, the composed opening, lineside thorn, // bank scrub, waterside growth and town gardens, then groups the trees by 50 m cell and species. The diff --git a/core/golden_line_tunnel.ts b/examples/golden_line/golden_line_tunnel.ts similarity index 100% rename from core/golden_line_tunnel.ts rename to examples/golden_line/golden_line_tunnel.ts diff --git a/core/golden_line_vegetation.ts b/examples/golden_line/golden_line_vegetation.ts similarity index 99% rename from core/golden_line_vegetation.ts rename to examples/golden_line/golden_line_vegetation.ts index ff57463c..1b0f6119 100644 --- a/core/golden_line_vegetation.ts +++ b/examples/golden_line/golden_line_vegetation.ts @@ -1,12 +1,12 @@ // The Golden Line's trees on the GPU: a port of golden-line's src/vegetation/trees.js, impostor.js, // palette.js and ground.js (github.com/StarKnightt/golden-line, MIT License, Copyright (c) 2026 -// Prasenjit (StarKnightt)). The trees themselves come from core/golden_line_trees.ts, their meshes -// from core/golden_line_treegen.ts and their textures from core/golden_line_textures.ts; the shaders +// Prasenjit (StarKnightt)). The trees themselves come from examples/golden_line/golden_line_trees.ts, their meshes +// from examples/golden_line/golden_line_treegen.ts and their textures from examples/golden_line/golden_line_textures.ts; the shaders // are shaders/golden_line_trees.hlsl. // -// Imported with `import { TreeRenderer } from "../core/golden_line_vegetation";` (from examples/). +// Imported with `import { TreeRenderer } from "./golden_line_vegetation";` (from examples/). -import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc, InputLayoutDesc } from "./donut"; +import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc, InputLayoutDesc } from "../../core/donut"; import { World, TerrainMesh, terrainColumns, deg, hypot2, SEG_VIADUCT, SEG_RIVER, SEG_TUNNEL, SUN_DIR_X, SUN_DIR_Z } from "./golden_line_world"; import { buildTrees, TREE_TYPES, TREE_STRIDE, TREE_BUSH } from "./golden_line_trees"; import { LsFarmSite, lsSiteFarm } from "./golden_line_lineside"; diff --git a/core/golden_line_water.ts b/examples/golden_line/golden_line_water.ts similarity index 99% rename from core/golden_line_water.ts rename to examples/golden_line/golden_line_water.ts index 7ae86dad..797f73af 100644 --- a/core/golden_line_water.ts +++ b/examples/golden_line/golden_line_water.ts @@ -3,9 +3,9 @@ // (c) 2026 Prasenjit (StarKnightt)). Lakes, rivers and the valley rivers under the viaducts share one // material (shaders/golden_line_water.hlsl) and one planar mirror, which the example draws. // -// Imported with `import { WaterRenderer } from "../core/golden_line_water";` (from examples/). +// Imported with `import { WaterRenderer } from "./golden_line_water";` (from examples/). -import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc, InputLayoutDesc } from "./donut"; +import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Frame, GraphicsPipelineDesc, InputLayoutDesc } from "../../core/donut"; import { World, Segment, Feature, Rng, terrainColumns, hypot2, toInt32, SEG_LAKE, SEG_RIVER, SEG_VIADUCT, SUN_DIR_X, SUN_DIR_Z, } from "./golden_line_world"; diff --git a/core/golden_line_wheels.ts b/examples/golden_line/golden_line_wheels.ts similarity index 100% rename from core/golden_line_wheels.ts rename to examples/golden_line/golden_line_wheels.ts diff --git a/core/golden_line_world.ts b/examples/golden_line/golden_line_world.ts similarity index 99% rename from core/golden_line_world.ts rename to examples/golden_line/golden_line_world.ts index 4afbd917..a7b8c8f3 100644 --- a/core/golden_line_world.ts +++ b/examples/golden_line/golden_line_world.ts @@ -5,7 +5,7 @@ // integers as the JavaScript does, so the same seed gives the same world (checked against the // original's arrays). // -// Imported with `import { ... } from "../core/golden_line_world";` (from examples/), and listed in the +// Imported with `import { ... } from "./golden_line_world";` (from examples/), and listed in the // example's add_tslang_example sources. // --- Math (src/core/math.js) --------------------------------------------------------------------- diff --git a/core/web_audio.ts b/examples/golden_line/web_audio.ts similarity index 95% rename from core/web_audio.ts rename to examples/golden_line/web_audio.ts index 2a256f32..c0a53548 100644 --- a/core/web_audio.ts +++ b/examples/golden_line/web_audio.ts @@ -2,10 +2,11 @@ // // The WebAudio class, as in donut.ts, over the Donut_* functions core/web_audio.cpp defines, kept // out of donut.ts (which every example links) for the examples that link core/web_audio.cpp: import -// with `import { WebAudio } from "../core/web_audio";` (from examples/) and list core/web_audio.ts -// with core/web_audio.cpp in the example's add_tslang_example sources. +// with `import { WebAudio } from "./web_audio";` (from examples/golden_line/) and list +// examples/golden_line/web_audio.ts with core/web_audio.cpp in the example's add_tslang_example +// sources. -/// +/// @value export class WebAudio { diff --git a/examples/hologram.ts b/examples/hologram/hologram.ts similarity index 99% rename from examples/hologram.ts rename to examples/hologram/hologram.ts index ad3dccf2..3eecad79 100644 --- a/examples/hologram.ts +++ b/examples/hologram/hologram.ts @@ -1,9 +1,9 @@ // donut.ts (the class wrappers over donut_interop.d.ts) comes in through input_pass.ts: tslang // would load it twice if this file referenced it too. -import { InputPass } from "../core/input_pass"; -import { Args } from "../core/args"; -import { TestCheck } from "../core/test_check"; -import { TEAPOT_POSITIONS, TEAPOT_NORMALS, TEAPOT_INDICES } from "../core/hologram_teapot"; +import { InputPass } from "../../core/input_pass"; +import { Args } from "../../core/args"; +import { TestCheck } from "../../core/test_check"; +import { TEAPOT_POSITIONS, TEAPOT_NORMALS, TEAPOT_INDICES } from "./hologram_teapot"; // Port of LunarG VulkanSamples' Hologram (Sample-Programs/Hologram, Copyright (C) 2016 Google, Inc., // Copyright (C) 2017 The Brenwill Workshop Ltd., Apache License 2.0): 5000 small pyramids, icospheres and teapots drifting through a 2 x 2 x 2 box, diff --git a/core/hologram_teapot.ts b/examples/hologram/hologram_teapot.ts similarity index 100% rename from core/hologram_teapot.ts rename to examples/hologram/hologram_teapot.ts diff --git a/examples/memory_management.ts b/examples/memory_management/memory_management.ts similarity index 99% rename from examples/memory_management.ts rename to examples/memory_management/memory_management.ts index c4774fa8..38a249fd 100644 --- a/examples/memory_management.ts +++ b/examples/memory_management/memory_management.ts @@ -1,8 +1,8 @@ // donut.ts (the class wrappers over donut_interop.d.ts) comes in through input_pass.ts: tslang // would load it twice if this file referenced it too. -import { InputPass } from "../core/input_pass"; -import { Args } from "../core/args"; -import { PagedImageSet } from "../core/paged_images"; +import { InputPass } from "../../core/input_pass"; +import { Args } from "../../core/args"; +import { PagedImageSet } from "./paged_images"; namespace MemoryManagement { const WINDOW_TITLE = "Donut Example: Memory Management"; diff --git a/core/paged_images.ts b/examples/memory_management/paged_images.ts similarity index 94% rename from core/paged_images.ts rename to examples/memory_management/paged_images.ts index 9459d1e2..3c45e6a5 100644 --- a/core/paged_images.ts +++ b/examples/memory_management/paged_images.ts @@ -2,11 +2,11 @@ // // The PagedImageSet class, as in donut.ts, over the Donut_* functions core/paged_images.cpp // defines, kept out of donut.ts (which every example links) for the examples that link -// core/paged_images.cpp: import with `import { PagedImageSet } from "../core/paged_images";` (from -// examples/) and list core/paged_images.ts with core/paged_images.cpp in the example's -// add_tslang_example sources. +// core/paged_images.cpp: import with `import { PagedImageSet } from "./paged_images";` (from +// examples/memory_management/) and list examples/memory_management/paged_images.ts with +// core/paged_images.cpp in the example's add_tslang_example sources. -/// +/// @value export class PagedImageSet { diff --git a/core/omm_bake.ts b/examples/opacity_micromaps/omm_bake.ts similarity index 93% rename from core/omm_bake.ts rename to examples/opacity_micromaps/omm_bake.ts index 52579191..9e6e7724 100644 --- a/core/omm_bake.ts +++ b/examples/opacity_micromaps/omm_bake.ts @@ -2,10 +2,11 @@ // // The OmmBaker class, as in donut.ts, over the Donut_* functions core/omm_bake.cpp defines, kept // out of donut.ts (which every example links) for the examples that link core/omm_bake.cpp: import -// with `import { OmmBaker } from "../core/omm_bake";` (from examples/) and list core/omm_bake.ts -// with core/omm_bake.cpp in the example's add_tslang_example sources. +// with `import { OmmBaker } from "./omm_bake";` (from examples/opacity_micromaps/) and list +// examples/opacity_micromaps/omm_bake.ts with core/omm_bake.cpp in the example's add_tslang_example +// sources. -/// +/// @value export class OmmBaker { diff --git a/examples/opacity_micromaps.ts b/examples/opacity_micromaps/opacity_micromaps.ts similarity index 99% rename from examples/opacity_micromaps.ts rename to examples/opacity_micromaps/opacity_micromaps.ts index a20af7dc..cbc6b8f9 100644 --- a/examples/opacity_micromaps.ts +++ b/examples/opacity_micromaps/opacity_micromaps.ts @@ -1,13 +1,13 @@ // donut.ts (the class wrappers over donut_interop.d.ts) comes in through input_pass.ts: tslang // would load it twice if this file referenced it too. -import { InputPass } from "../core/input_pass"; -import { Args } from "../core/args"; -import { TestCheck, unsupported } from "../core/test_check"; -import { OmmBaker } from "../core/omm_bake"; +import { InputPass } from "../../core/input_pass"; +import { Args } from "../../core/args"; +import { TestCheck, unsupported } from "../../core/test_check"; +import { OmmBaker } from "./omm_bake"; import { cross3, matrixInverse, matrixLookAtLH, matrixMultiply, matrixPerspectiveFovLH, matrixRotationY, normalize3, normalize4, radians, transform3, vsub, -} from "../core/directx_math"; +} from "../../core/directx_math"; namespace OpacityMicromaps { // Test mode: the frames rendered. diff --git a/core/rtxdi_di.ts b/examples/rtxdi_minimal/rtxdi_di.ts similarity index 98% rename from core/rtxdi_di.ts rename to examples/rtxdi_minimal/rtxdi_di.ts index a6071a01..23bc4369 100644 --- a/core/rtxdi_di.ts +++ b/examples/rtxdi_minimal/rtxdi_di.ts @@ -6,15 +6,15 @@ // Written from the Minimal Sample's RtxdiResources, RenderTargets, PrepareLightsPass and RenderPass; the // shaders are the sample's, compiled in place from RTXDI_DIR (rtxdi_minimal_shaders in CMakeLists.txt). // -// Imported with `import { RtxdiDI, ... } from "../core/rtxdi_di";` (from examples/); list core/rtxdi_di.ts with +// Imported with `import { RtxdiDI, ... } from "./rtxdi_di";` (from examples/); list examples/rtxdi_minimal/rtxdi_di.ts with // core/rtxdi.cpp and core/rtxdi_minimal.cpp (RTXDI_GLUE_SOURCES) in the example's add_tslang_example sources. // // The sample is under the NVIDIA RTX SDKs License. This software contains source code provided by NVIDIA // Corporation. -/// +/// -import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Scene } from "./donut"; +import { App, BindingLayoutDesc, BindingSet, BindingSetDesc, CommandList, Scene } from "../../core/donut"; // PrepareLights.hlsl's [numthreads(256, 1, 1)]: a thread per light (emissive triangle). const PREPARE_LIGHTS_GROUP_SIZE = 256; diff --git a/examples/rtxdi_minimal.ts b/examples/rtxdi_minimal/rtxdi_minimal.ts similarity index 99% rename from examples/rtxdi_minimal.ts rename to examples/rtxdi_minimal/rtxdi_minimal.ts index 7b7f92a6..47f06122 100644 --- a/examples/rtxdi_minimal.ts +++ b/examples/rtxdi_minimal/rtxdi_minimal.ts @@ -1,11 +1,11 @@ // donut.ts (the class wrappers over donut_interop.d.ts) comes in through input_pass.ts: tslang // would load it twice if this file referenced it too. -import { InputPass } from "../core/input_pass"; -import { Args } from "../core/args"; -import { TestCheck, isFinite32, unsupported } from "../core/test_check"; -import { perspProjD3DStyleReverse } from "../core/matrix"; -import { formatFixed } from "../core/text_format"; -import { PrepareLightsPass, RenderPass, RtxdiDI, RtxdiMinimalSettings, RtxdiRenderTargets } from "../core/rtxdi_di"; +import { InputPass } from "../../core/input_pass"; +import { Args } from "../../core/args"; +import { TestCheck, isFinite32, unsupported } from "../../core/test_check"; +import { perspProjD3DStyleReverse } from "../../core/matrix"; +import { formatFixed } from "../../core/text_format"; +import { PrepareLightsPass, RenderPass, RtxdiDI, RtxdiMinimalSettings, RtxdiRenderTargets } from "./rtxdi_di"; // Port of NVIDIA's RTXDI Minimal Sample (github.com/NVIDIA-RTX/RTXDI, Samples/MinimalSample, RTXDI 3.0.0): the // Arcade lit by its emissive triangles, ReSTIR DI fused into one compute pass (primary rays, initial sampling, diff --git a/core/rtxmg.ts b/examples/rtxmg_demo/rtxmg.ts similarity index 95% rename from core/rtxmg.ts rename to examples/rtxmg_demo/rtxmg.ts index 6e3d8c33..d6740d3a 100644 --- a/core/rtxmg.ts +++ b/examples/rtxmg_demo/rtxmg.ts @@ -2,10 +2,10 @@ // // The RtxmgDemo class, as in donut.ts, over the Donut_* functions core/rtxmg.cpp defines, kept out // of donut.ts (which every example links) for the examples that link core/rtxmg.cpp: import with -// `import { RtxmgDemo } from "../core/rtxmg";` (from examples/) and list core/rtxmg.ts with -// core/rtxmg.cpp in the example's add_tslang_example sources. +// `import { RtxmgDemo } from "./rtxmg";` (from examples/rtxmg_demo/) and list +// examples/rtxmg_demo/rtxmg.ts with core/rtxmg.cpp in the example's add_tslang_example sources. -/// +/// @value export class RtxmgDemo { @@ -94,7 +94,7 @@ export class RtxmgDemo { Donut_RtxmgWriteBlitParams(this.handle, openCommandList, exposure); } - // A buffer the path tracer or the blit binds (RTXMG_BUFFER_* in examples/rtxmg_demo.ts), a dummy for + // A buffer the path tracer or the blit binds (RTXMG_BUFFER_* in examples/rtxmg_demo/rtxmg_demo.ts), a dummy for // one the scene hasn't; null for an unknown index. getBuffer(which: int): BufferHandle { return Donut_RtxmgGetBuffer(this.handle, which); diff --git a/examples/rtxmg_demo.ts b/examples/rtxmg_demo/rtxmg_demo.ts similarity index 99% rename from examples/rtxmg_demo.ts rename to examples/rtxmg_demo/rtxmg_demo.ts index 32a06fbe..fcd8082e 100644 --- a/examples/rtxmg_demo.ts +++ b/examples/rtxmg_demo/rtxmg_demo.ts @@ -10,9 +10,9 @@ // rtxmg_demo --media /assets --scene subdivision/amy_kitchenset.scene.json // RTXMG is under the NVIDIA RTX SDKs License: nothing of it is in this repository. -import { Args } from "../core/args"; -import { TestCheck, unsupported } from "../core/test_check"; -import { RtxmgDemo } from "../core/rtxmg"; +import { Args } from "../../core/args"; +import { TestCheck, unsupported } from "../../core/test_check"; +import { RtxmgDemo } from "./rtxmg"; namespace RtxmgDemoExample { const WINDOW_TITLE = "RTX Mega Geometry"; diff --git a/examples/rtxpt.ts b/examples/rtxpt/rtxpt.ts similarity index 99% rename from examples/rtxpt.ts rename to examples/rtxpt/rtxpt.ts index 967e5ac0..e6a78504 100644 --- a/examples/rtxpt.ts +++ b/examples/rtxpt/rtxpt.ts @@ -1,10 +1,10 @@ // donut.ts (the class wrappers over donut_interop.d.ts) comes in through input_pass.ts: tslang // would load it twice if this file referenced it too. -import { InputPass } from "../core/input_pass"; -import { Args } from "../core/args"; -import { TestCheck, unsupported } from "../core/test_check"; -import { RtxptRenderer } from "../core/rtxpt_renderer"; -import { RtxptGame, GameWorld } from "../core/rtxpt_game"; +import { InputPass } from "../../core/input_pass"; +import { Args } from "../../core/args"; +import { TestCheck, unsupported } from "../../core/test_check"; +import { RtxptRenderer } from "./rtxpt_renderer"; +import { RtxptGame, GameWorld } from "../../core/rtxpt_game"; // Port of NVIDIA's RTX Path Tracing sample (github.com/NVIDIA-RTX/RTXPT): its reference path tracer and its // real-time mode with the standalone denoiser (NRD's ReBLUR or ReLAX) and TAA. The diff --git a/core/rtxpt_renderer.ts b/examples/rtxpt/rtxpt_renderer.ts similarity index 95% rename from core/rtxpt_renderer.ts rename to examples/rtxpt/rtxpt_renderer.ts index 01a62250..e747dd31 100644 --- a/core/rtxpt_renderer.ts +++ b/examples/rtxpt/rtxpt_renderer.ts @@ -2,10 +2,10 @@ // // The RtxptRenderer class, as in donut.ts, over the Donut_* functions core/rtxpt.cpp defines, kept // out of donut.ts (which every example links) for the examples that link core/rtxpt.cpp: import -// with `import { RtxptRenderer } from "../core/rtxpt_renderer";` (from examples/) and list -// core/rtxpt_renderer.ts with core/rtxpt.cpp in the example's add_tslang_example sources. +// with `import { RtxptRenderer } from "./rtxpt_renderer";` (from examples/rtxpt/) and list +// examples/rtxpt/rtxpt_renderer.ts with core/rtxpt.cpp in the example's add_tslang_example sources. -/// +/// @value export class RtxptRenderer { @@ -119,7 +119,7 @@ export class RtxptRenderer { return Donut_RtxptRendererPrepare(this.handle, width, height, displayWidth, displayHeight, needNewPasses, rebuildAccelStructs, neeatQualityPreset); } - // Takes the frame's settings (examples/rtxpt.ts's FRAME_SETTINGS_SIZE bytes) and records everything up to the path + // Takes the frame's settings (examples/rtxpt/rtxpt.ts's FRAME_SETTINGS_SIZE bytes) and records everything up to the path // tracing pass. True if the environment map changed: reset the accumulation at the next frame. beginFrame(commandList: CommandListHandle, frameSettings: Ref): boolean { return Donut_RtxptRendererBeginFrame(this.handle, commandList, frameSettings); diff --git a/core/obj_model.ts b/examples/sakura_forest_ser/obj_model.ts similarity index 88% rename from core/obj_model.ts rename to examples/sakura_forest_ser/obj_model.ts index aca8166c..2d851d1a 100644 --- a/core/obj_model.ts +++ b/examples/sakura_forest_ser/obj_model.ts @@ -2,10 +2,11 @@ // // The ObjModel class, as in donut.ts, over the Donut_* functions core/obj_model.cpp defines, kept // out of donut.ts (which every example links) for the examples that link core/obj_model.cpp: import -// with `import { ObjModel } from "../core/obj_model";` (from examples/) and list core/obj_model.ts -// with core/obj_model.cpp in the example's add_tslang_example sources. +// with `import { ObjModel } from "./obj_model";` (from examples/sakura_forest_ser/) and list +// examples/sakura_forest_ser/obj_model.ts with core/obj_model.cpp in the example's +// add_tslang_example sources. -/// +/// @value export class ObjModel { diff --git a/examples/sakura_forest_ser.ts b/examples/sakura_forest_ser/sakura_forest_ser.ts similarity index 99% rename from examples/sakura_forest_ser.ts rename to examples/sakura_forest_ser/sakura_forest_ser.ts index 4ca0e225..e797f66a 100644 --- a/examples/sakura_forest_ser.ts +++ b/examples/sakura_forest_ser/sakura_forest_ser.ts @@ -1,13 +1,13 @@ // donut.ts (the class wrappers over donut_interop.d.ts) comes in through input_pass.ts: tslang // would load it twice if this file referenced it too. -import { InputPass } from "../core/input_pass"; -import { Args } from "../core/args"; -import { unsupported } from "../core/test_check"; -import { ObjModel } from "../core/obj_model"; +import { InputPass } from "../../core/input_pass"; +import { Args } from "../../core/args"; +import { unsupported } from "../../core/test_check"; +import { ObjModel } from "./obj_model"; import { cross3, matrixInverse, matrixLookAtLH, matrixMultiply, matrixPerspectiveFovLH, matrixRotationAxis, matrixRotationY, normalize3, normalize4, radians, transform3, transformNormal3, vadd, vmul, vsub, -} from "../core/directx_math"; +} from "../../core/directx_math"; namespace SakuraForestSER { const WINDOW_TITLE = "D3D12 Raytracing - Sakura Scene"; diff --git a/core/video_player.ts b/examples/video_texture/video_player.ts similarity index 91% rename from core/video_player.ts rename to examples/video_texture/video_player.ts index f5d3579d..6386c733 100644 --- a/core/video_player.ts +++ b/examples/video_texture/video_player.ts @@ -2,11 +2,11 @@ // // The VideoPlayer class, as in donut.ts, over the Donut_* functions core/video_player.cpp defines, // kept out of donut.ts (which every example links) for the examples that link -// core/video_player.cpp: import with `import { VideoPlayer } from "../core/video_player";` (from -// examples/) and list core/video_player.ts with core/video_player.cpp in the example's -// add_tslang_example sources. +// core/video_player.cpp: import with `import { VideoPlayer } from "./video_player";` (from +// examples/video_texture/) and list examples/video_texture/video_player.ts with +// core/video_player.cpp in the example's add_tslang_example sources. -/// +/// @value export class VideoPlayer { diff --git a/examples/video_texture.ts b/examples/video_texture/video_texture.ts similarity index 98% rename from examples/video_texture.ts rename to examples/video_texture/video_texture.ts index 021fb78f..f91308f9 100644 --- a/examples/video_texture.ts +++ b/examples/video_texture/video_texture.ts @@ -1,10 +1,10 @@ // donut.ts (the class wrappers over donut_interop.d.ts) comes in through input_pass.ts: tslang // would load it twice if this file referenced it too. -import { InputPass } from "../core/input_pass"; -import { Args } from "../core/args"; -import { TestCheck } from "../core/test_check"; -import { VideoPlayer } from "../core/video_player"; -import { rotationY, cross3, dot3, normalize3 } from "../core/matrix"; +import { InputPass } from "../../core/input_pass"; +import { Args } from "../../core/args"; +import { TestCheck } from "../../core/test_check"; +import { VideoPlayer } from "./video_player"; +import { rotationY, cross3, dot3, normalize3 } from "../../core/matrix"; namespace VideoTexture { // Test mode: the frames rendered. diff --git a/run_jit_rtxdi.bat b/run_jit_rtxdi.bat index 53c84fbf..f2642b17 100644 --- a/run_jit_rtxdi.bat +++ b/run_jit_rtxdi.bat @@ -2,5 +2,5 @@ @rem core/rtxdi.cpp and core/rtxdi_minimal.cpp, from a build with RTXDI_DIR). From the repo root. Runs on D3D12 (-dx12 is hardcoded: edit it for Vulkan). @pushd %~dp0 set D=build-rtxdi/bin -"tslang.exe" --shared-libs=%D%/donut_interop_shared.dll examples/rtxdi_minimal.ts -- -dx12 %* +"tslang.exe" --shared-libs=%D%/donut_interop_shared.dll examples/rtxdi_minimal/rtxdi_minimal.ts -- -dx12 %* @popd diff --git a/shaders/clustered_geometry/RaytracingHlslCompat.h b/shaders/clustered_geometry/RaytracingHlslCompat.h index f432c60f..bdc0a1f3 100644 --- a/shaders/clustered_geometry/RaytracingHlslCompat.h +++ b/shaders/clustered_geometry/RaytracingHlslCompat.h @@ -12,7 +12,7 @@ // #pragma once -// examples/clustered_geometry.ts: the HLSL half only (the C++ half's #include would +// examples/clustered_geometry/clustered_geometry.ts: the HLSL half only (the C++ half's #include would // stop ShaderMake's include scan); the structures are mirrored in the example. #include "HlslCompat.h" diff --git a/shaders/golden_line.hlsl b/shaders/golden_line.hlsl index 885a4577..3872760f 100644 --- a/shaders/golden_line.hlsl +++ b/shaders/golden_line.hlsl @@ -389,7 +389,7 @@ float4 terrain_ps(TerrainVaryings i) : SV_Target // Tone mapping: three's ACES Filmic, into the 8-bit sRGB output. Texture2D t_hdr : register(t0); -Texture2D t_glow : register(t1); // the bloom, at half size (core/golden_line_bloom.ts) +Texture2D t_glow : register(t1); // the bloom, at half size (examples/golden_line/golden_line_bloom.ts) SamplerState s_glow : register(s1); void tonemap_vs(uint id : SV_VertexID, out float4 position : SV_Position) diff --git a/shaders/golden_line_birds.hlsl b/shaders/golden_line_birds.hlsl index 056c128a..840583c4 100644 --- a/shaders/golden_line_birds.hlsl +++ b/shaders/golden_line_birds.hlsl @@ -1,7 +1,7 @@ // The Golden Line's birds: a port of golden-line's src/effects/birds.js material // (github.com/StarKnightt/golden-line, MIT License, Copyright (c) 2026 Prasenjit (StarKnightt)). // -// One instanced draw of every bird (core/golden_line_birds.ts flies them): each wing bends at the shoulder +// One instanced draw of every bird (examples/golden_line/golden_line_birds.ts flies them): each wing bends at the shoulder // and again at the elbow, the outer half swept back; each wing edge is pushed half a pixel up or down the // screen so that seen edge-on it still shows as a stroke; the plumage is dark with a breath of sky, veiled // by the air with distance and then fogged as everything else is; and birds too small to show a shape, or diff --git a/shaders/golden_line_bloom.hlsl b/shaders/golden_line_bloom.hlsl index b9e5fdef..a0b820b0 100644 --- a/shaders/golden_line_bloom.hlsl +++ b/shaders/golden_line_bloom.hlsl @@ -1,6 +1,6 @@ // The Golden Line's bloom: three.js r187's BloomNode (examples/jsm/tsl/display/BloomNode.js; three.js MIT // License, Copyright 2010-2026 three.js authors) with golden-line's capped high pass (render/pipeline.js; -// MIT License, Copyright (c) 2026 Prasenjit (StarKnightt)). Driven by core/golden_line_bloom.ts: the +// MIT License, Copyright (c) 2026 Prasenjit (StarKnightt)). Driven by examples/golden_line/golden_line_bloom.ts: the // bright areas at half size, five levels blurred by a separable gaussian, summed into the glow. #include diff --git a/shaders/golden_line_hud.hlsl b/shaders/golden_line_hud.hlsl index e509709b..5eda0425 100644 --- a/shaders/golden_line_hud.hlsl +++ b/shaders/golden_line_hud.hlsl @@ -1,4 +1,4 @@ -// The Golden Line's HUD shapes (core/golden_line_hud.ts): the soft shades behind the corners, the rules, +// The Golden Line's HUD shapes (examples/golden_line/golden_line_hud.ts): the soft shades behind the corners, the rules, // the approach line and the gauge, the buttons and their icons, the toast and the tips, laid over the // finished frame in one full-screen pass that takes the blit's place. Each shape gives a coverage and a // colour; they are laid over one another in order (strokes marked to join make one shape, so an icon's @@ -33,7 +33,7 @@ void hud_vs(uint id : SV_VertexID, out float4 position : SV_Position) position = float4(uv.x * 2 - 1, 1 - uv.y * 2, 0, 1); } -// the gradients' stops (core/golden_line_hud.ts's HG_*): alpha at a position 0..1 +// the gradients' stops (examples/golden_line/golden_line_hud.ts's HG_*): alpha at a position 0..1 float stopsAt(int set, float t) { t = saturate(t); diff --git a/shaders/golden_line_motes.hlsl b/shaders/golden_line_motes.hlsl index 98c4e43c..20e2ec90 100644 --- a/shaders/golden_line_motes.hlsl +++ b/shaders/golden_line_motes.hlsl @@ -1,7 +1,7 @@ // The Golden Line's dust in the sunbeams: a port of golden-line's src/effects/motes.js material // (github.com/StarKnightt/golden-line, MIT License, Copyright (c) 2026 Prasenjit (StarKnightt)). // -// One instanced quad per mote (core/golden_line_motes.ts lights them): each drifts about its home in the +// One instanced quad per mote (examples/golden_line/golden_line_motes.ts lights them): each drifts about its home in the // camera coach, follows the sun's ray to the wall on the sunny side and lights up only if it leaves through // a window opening; a few millimetres across but never thinner than about a pixel (dimmed to keep its // energy), it blazes looking toward the light, winks as it turns, and stays faint against the chair back diff --git a/shaders/golden_line_puffs.hlsl b/shaders/golden_line_puffs.hlsl index 0c79835a..58ac9566 100644 --- a/shaders/golden_line_puffs.hlsl +++ b/shaders/golden_line_puffs.hlsl @@ -4,7 +4,7 @@ // puff_density_cs fills a 128^3 volume with one variant's cauliflower (lobes blended into one body, // eroded by turbulence, torn for the wispy variants); puff_march_cs marches it toward the viewer for // each texel of the variant's tile, lighting every sample from six directions (eight growing steps toward -// each light; two exponentials stand in for multiple scattering). core/golden_line_puffs.ts runs both for +// each light; two exponentials stand in for multiple scattering). examples/golden_line/golden_line_puffs.ts runs both for // the sixteen variants in turn. #include diff --git a/shaders/memory_management.hlsl b/shaders/memory_management.hlsl index 2d876e30..72c92b38 100644 --- a/shaders/memory_management.hlsl +++ b/shaders/memory_management.hlsl @@ -1,5 +1,5 @@ // DirectX-Graphics-Samples' D3D12MemoryManagement shaders (Texture.hlsl, Color.hlsl) for -// examples/memory_management.ts: a screen-space rectangle per draw, textured (an image, modulated +// examples/memory_management/memory_management.ts: a screen-space rectangle per draw, textured (an image, modulated // by a color) or filled with a color, under the sample's orthographic camera. The rectangle's // corners come from push constants rather than a vertex buffer, in the sample's vertex order. // diff --git a/shaders/rtxdi_minimal.cfg b/shaders/rtxdi_minimal.cfg index 2ed0faf0..d35d74cf 100644 --- a/shaders/rtxdi_minimal.cfg +++ b/shaders/rtxdi_minimal.cfg @@ -1,4 +1,4 @@ -// The precompiled shaders of rtxdi_minimal (examples/rtxdi_minimal.ts): the Minimal Sample's two compute +// The precompiled shaders of rtxdi_minimal (examples/rtxdi_minimal/rtxdi_minimal.ts): the Minimal Sample's two compute // shaders, RTXDI_DIR/Samples/MinimalSample/Shaders compiled in place (--sourceDir, see CMakeLists.txt). // // This software contains source code provided by NVIDIA Corporation. diff --git a/shaders/rtxpt.cfg b/shaders/rtxpt.cfg index bf4c9b9f..aa1e4bb0 100644 --- a/shaders/rtxpt.cfg +++ b/shaders/rtxpt.cfg @@ -1,4 +1,4 @@ -// The precompiled shaders of rtxpt (examples/rtxpt.ts): RTXPT_DIR/Rtxpt's, compiled in place +// The precompiled shaders of rtxpt (examples/rtxpt/rtxpt.ts): RTXPT_DIR/Rtxpt's, compiled in place // (--sourceDir), the ones its reference path tracer's passes create through the ShaderFactory. The path // tracer itself compiles at run time (ShaderDynamic/, see CMakeLists.txt). // diff --git a/shaders/sakura_forest_ser.hlsl b/shaders/sakura_forest_ser.hlsl index f588fecc..a96d4ba1 100644 --- a/shaders/sakura_forest_ser.hlsl +++ b/shaders/sakura_forest_ser.hlsl @@ -10,7 +10,7 @@ //********************************************************* // DirectX-Graphics-Samples' D3D12RaytracingSakuraForestSER Raytracing.hlsl, for -// examples/sakura_forest_ser.ts: a ray generation shader tracing primary rays through hit objects +// examples/sakura_forest_ser/sakura_forest_ser.ts: a ray generation shader tracing primary rays through hit objects // (HitObject::TraceRay, MaybeReorderThread by the hit, by a reflection hint, or by both, then // HitObject::Invoke), closest hit shaders per material, and a fractal sky (Star Nest) in the miss // shader. Shader model 6.9; column-major matrices, as the sample compiles it at run time. diff --git a/tools/capture_screenshots.ps1 b/tools/capture_screenshots.ps1 index 5cca9112..20b930ca 100644 --- a/tools/capture_screenshots.ps1 +++ b/tools/capture_screenshots.ps1 @@ -44,7 +44,7 @@ $outDir = Join-Path $root "docs/screenshots" New-Item -ItemType Directory -Force $outDir | Out-Null if ($exampleList.Count -eq 0) { - $exampleList = @(Get-ChildItem (Join-Path $root "examples/*.ts"), (Join-Path $root "examples/nri/*.ts") | + $exampleList = @(Get-ChildItem (Join-Path $root "examples/*.ts"), (Join-Path $root "examples/*/*.ts") | ForEach-Object { $_.BaseName } | Where-Object { $_ -notin @("headless", "nvrhi_direct") -and (Test-Path (Join-Path $bin "$_.exe")) }) } diff --git a/tools/find_untyped_handles.py b/tools/find_untyped_handles.py index 32ba5c20..4ead6505 100644 --- a/tools/find_untyped_handles.py +++ b/tools/find_untyped_handles.py @@ -1,4 +1,4 @@ -"""Lists the places in core/*.ts and examples/*.ts where Opaque stands for a handle: fields, +"""Lists the places in core/*.ts and examples/[*/]*.ts where Opaque stands for a handle: fields, locals, parameters and callbacks still typed Opaque that hold, receive or pass typed handles. python tools/find_untyped_handles.py @@ -44,7 +44,7 @@ def run_tsc(): with open(config, "w", encoding="utf-8") as f: f.write('{"extends": %s, "compilerOptions": {"types": %s, "incremental": false}, "include": %s}' % ( json.dumps(os.path.join(ROOT, "tsconfig.json").replace("\\", "/")), entries, - json.dumps([os.path.join(ROOT, d, "*.ts").replace("\\", "/") for d in ("core", "examples")]))) + json.dumps([os.path.join(ROOT, d, "*.ts").replace("\\", "/") for d in ("core", "examples", "examples/*")]))) result = subprocess.run("npx --no-install tsc --noEmit -p " + config, cwd=ROOT, capture_output=True, text=True, shell=True) return result.stdout diff --git a/tools/generate_donut_wrappers.py b/tools/generate_donut_wrappers.py index 98a542bf..22fcee7c 100644 --- a/tools/generate_donut_wrappers.py +++ b/tools/generate_donut_wrappers.py @@ -19,6 +19,7 @@ """ import os +import posixpath import re import sys import textwrap @@ -584,10 +585,30 @@ def handle_type(cls, handles): return f"{cls}Handle" if f"{cls}Handle" in handles else "Opaque" +# The folder of a module only one example imports: that example's (examples//, beside its +# main source). The others are in core/. +MODULE_DIRS = { + "pbrt_scene": "examples/denoised_rtao", + "rtxmg": "examples/rtxmg_demo", + "rtxpt_renderer": "examples/rtxpt", + "obj_model": "examples/sakura_forest_ser", + "paged_images": "examples/memory_management", + "omm_bake": "examples/opacity_micromaps", + "web_audio": "examples/golden_line", + "clas": "examples/clustered_geometry", + "fbc_texture": "examples/fast_block_compress", + "video_player": "examples/video_texture", +} + + +def module_dir(module): + return MODULE_DIRS.get(module, "core") + + MODULE_HEADER = ( "{classes}, as in donut.ts, over the Donut_* functions {source} defines, kept out of donut.ts " "(which every example links) for the examples that link {source}: import with " - "`import {{ {names} }} from \"../core/{module}\";` (from examples/) and list core/{module}.ts with " + "`import {{ {names} }} from \"{import_path}\";` (from {importer}) and list {dir}/{module}.ts with " "{source} in the example's add_tslang_example sources." ) @@ -631,12 +652,16 @@ def generate(functions, handles, module=None): if module: classes = [cls for cls in all_classes if MODULES.get(cls, (None,))[0] == module] source = MODULES[classes[0]][1] + folder = module_dir(module) + local = folder != "core" text = MODULE_HEADER.format( classes=("The " + classes[0] + " class" if len(classes) == 1 else "The classes " + ", ".join(classes)), - source=source, names=", ".join(classes), module=module) + source=source, names=", ".join(classes), module=module, dir=folder, + import_path=("./" if local else "../core/") + module, importer=(folder + "/" if local else "examples/")) + interop = posixpath.relpath("core/donut_interop.d.ts", folder) out = ["// Generated by tools/generate_donut_wrappers.py from donut_interop.d.ts: don't edit, regenerate.", "//"] out += ["// " + line for line in textwrap.wrap(text, 100 - len("// "), break_on_hyphens=False)] - out += ["", '/// '] + out += ["", f'/// '] else: classes = [cls for cls in all_classes if cls not in MODULES] out = [HEADER.rstrip("\n")] @@ -746,7 +771,7 @@ def main(): with open(GLOBALS, "w", encoding="utf-8", newline="\n") as f: f.write(generate_globals(classes)) for module in sorted({m for m, _ in MODULES.values()}): - with open(os.path.join(ROOT, "core", module + ".ts"), "w", encoding="utf-8", newline="\n") as f: + with open(os.path.join(ROOT, module_dir(module), module + ".ts"), "w", encoding="utf-8", newline="\n") as f: f.write(generate(functions, handles, module)) diff --git a/tools/smoke_examples.ps1 b/tools/smoke_examples.ps1 index ffe84855..c2d8f7b1 100644 --- a/tools/smoke_examples.ps1 +++ b/tools/smoke_examples.ps1 @@ -25,7 +25,7 @@ $logs = Join-Path $root "build/smoke" New-Item -ItemType Directory -Force $logs | Out-Null if ($exampleList.Count -eq 0) { - $exampleList = @(Get-ChildItem (Join-Path $root "examples/*.ts"), (Join-Path $root "examples/nri/*.ts") | + $exampleList = @(Get-ChildItem (Join-Path $root "examples/*.ts"), (Join-Path $root "examples/*/*.ts") | ForEach-Object { $_.BaseName } | Where-Object { Test-Path (Join-Path $bin "$_.exe") }) } diff --git a/tsconfig.json b/tsconfig.json index 46968ae3..e1e9f8ff 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,7 +22,7 @@ "lib": ["ESNext"], "types": ["./types/tslang", "./tools/tslang/defaultlib/lib.d.ts", "C:/Utils/tslang/defaultlib/lib.d.ts", "I:/tslang/defaultlib/lib.d.ts"] }, - "include": ["core/*.ts", "examples/*.ts", "examples/nri/*.ts"], + "include": ["core/*.ts", "examples/*.ts", "examples/*/*.ts"], // tslang merges the `nvrhi` namespaces of core/nvrhi*.ts, TypeScript does not: // tools/gen_nvrhi_editor.mjs writes core/nvrhi.editor..ts, the merged namespace the examples // import, and core/nvrhi.globals..d.ts, its members as globals for the sources, which From fead84620564be01a355a32687bc6b4bb600ce50 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 5 Dec 2026 18:26:31 +0000 Subject: [PATCH 2/2] Move single-example native files out of core/ into examples// The C++ (and its private headers) only one example links now sits with that example: web_audio, denoised_rtao + pbrt/, omm_bake, paged_images, fast_block_compress + fbc_cpu, obj_model, clas, video_player, rtxpt, rtxdi + rtxdi_minimal, rtxmg, streamline (streamline_demo gets a folder) and msvc_fast_math (raytracing_mini_engine). The interop declarations stay in core/interop, as every example compiles them; the interop check reads examples/*/*.cpp too. Co-Authored-By: Claude Opus 5.5 --- CMakeLists.txt | 123 +++++++++--------- README.md | 12 +- core/donut.ts | 4 +- core/donut_interop.cpp | 6 +- core/donut_interop.d.ts | 2 +- core/interop/app.d.ts | 2 +- core/interop/clas.d.ts | 6 +- core/interop/denoised_rtao.d.ts | 2 +- core/interop/device.d.ts | 2 +- core/interop/fast_block_compress.d.ts | 6 +- core/interop/math.d.ts | 4 +- core/interop/obj_model.d.ts | 4 +- core/interop/omm_bake.d.ts | 4 +- core/interop/paged_images.d.ts | 4 +- core/interop/raytracing.d.ts | 2 +- core/interop/rtxdi.d.ts | 2 +- core/interop/rtxdi_minimal.d.ts | 4 +- core/interop/rtxmg.d.ts | 2 +- core/interop/rtxpt.d.ts | 2 +- core/interop/streamline.d.ts | 2 +- core/interop/video_player.d.ts | 4 +- core/interop/web_audio.d.ts | 2 +- core/rtxpt_game.ts | 2 +- docs/clustered_geometry_vulkan_gpu_faults.md | 4 +- docs/mimalloc.md | 2 +- docs/nri_migration_order.md | 2 +- .../plans/2026-11-07-rtxmg-cluster-tess.md | 6 +- .../plans/2026-11-08-rtxdi-minimal.md | 14 +- .../plans/2026-11-08-streamline-demo.md | 16 +-- ...2026-10-10-typed-interop-handles-design.md | 2 +- .../specs/2026-11-08-rtxdi-minimal-design.md | 10 +- .../clustered_geometry}/clas.cpp | 2 +- examples/clustered_geometry/clas.ts | 14 +- .../clustered_geometry/clustered_geometry.ts | 4 +- .../denoised_rtao}/denoised_rtao.cpp | 4 +- .../denoised_rtao}/pbrt/PBRTParser.cpp | 0 .../denoised_rtao}/pbrt/PBRTParser.h | 0 .../denoised_rtao}/pbrt/PlyParser.cpp | 0 .../denoised_rtao}/pbrt/PlyParser.h | 0 .../denoised_rtao}/pbrt/SceneParser.h | 0 .../denoised_rtao}/pbrt/pbrt_stdafx.h | 0 examples/denoised_rtao/pbrt_scene.ts | 9 +- .../fast_block_compress.cpp | 2 +- .../fast_block_compress}/fbc_cpu.cpp | 0 .../fast_block_compress}/fbc_cpu.h | 0 .../fast_block_compress}/fbc_cpu_compat.h | 0 examples/fast_block_compress/fbc_texture.ts | 16 ++- examples/golden_line/golden_line.ts | 2 +- examples/golden_line/golden_line_sound.ts | 2 +- {core => examples/golden_line}/web_audio.cpp | 2 +- examples/golden_line/web_audio.ts | 10 +- .../memory_management/memory_management.ts | 2 +- .../memory_management}/paged_images.cpp | 4 +- examples/memory_management/paged_images.ts | 13 +- .../opacity_micromaps}/omm_bake.cpp | 4 +- examples/opacity_micromaps/omm_bake.ts | 13 +- .../opacity_micromaps/opacity_micromaps.ts | 2 +- .../msvc_fast_math.cpp | 2 +- .../raytracing_mini_engine.ts | 10 +- {core => examples/rtxdi_minimal}/rtxdi.cpp | 4 +- examples/rtxdi_minimal/rtxdi_di.ts | 4 +- .../rtxdi_minimal}/rtxdi_minimal.cpp | 6 +- examples/rtxdi_minimal/rtxdi_minimal.ts | 2 +- {core => examples/rtxmg_demo}/rtxmg.cpp | 2 +- examples/rtxmg_demo/rtxmg.ts | 9 +- examples/rtxmg_demo/rtxmg_demo.ts | 6 +- {core => examples/rtxpt}/rtxpt.cpp | 2 +- examples/rtxpt/rtxpt.ts | 12 +- examples/rtxpt/rtxpt_renderer.ts | 9 +- .../sakura_forest_ser}/obj_model.cpp | 2 +- examples/sakura_forest_ser/obj_model.ts | 13 +- .../streamline_demo}/streamline.cpp | 2 +- .../{ => streamline_demo}/streamline_demo.ts | 12 +- .../video_texture}/video_player.cpp | 2 +- examples/video_texture/video_player.ts | 13 +- run_jit_rtxdi.bat | 2 +- run_jit_streamline.bat | 2 +- tools/check_interop_types.py | 7 +- tools/generate_donut_wrappers.py | 26 ++-- 79 files changed, 262 insertions(+), 251 deletions(-) rename {core => examples/clustered_geometry}/clas.cpp (99%) rename {core => examples/denoised_rtao}/denoised_rtao.cpp (99%) rename {core => examples/denoised_rtao}/pbrt/PBRTParser.cpp (100%) rename {core => examples/denoised_rtao}/pbrt/PBRTParser.h (100%) rename {core => examples/denoised_rtao}/pbrt/PlyParser.cpp (100%) rename {core => examples/denoised_rtao}/pbrt/PlyParser.h (100%) rename {core => examples/denoised_rtao}/pbrt/SceneParser.h (100%) rename {core => examples/denoised_rtao}/pbrt/pbrt_stdafx.h (100%) rename {core => examples/fast_block_compress}/fast_block_compress.cpp (99%) rename {core => examples/fast_block_compress}/fbc_cpu.cpp (100%) rename {core => examples/fast_block_compress}/fbc_cpu.h (100%) rename {core => examples/fast_block_compress}/fbc_cpu_compat.h (100%) rename {core => examples/golden_line}/web_audio.cpp (99%) rename {core => examples/memory_management}/paged_images.cpp (99%) rename {core => examples/opacity_micromaps}/omm_bake.cpp (98%) rename {core => examples/raytracing_mini_engine}/msvc_fast_math.cpp (98%) rename examples/{ => raytracing_mini_engine}/raytracing_mini_engine.ts (99%) rename {core => examples/rtxdi_minimal}/rtxdi.cpp (98%) rename {core => examples/rtxdi_minimal}/rtxdi_minimal.cpp (98%) rename {core => examples/rtxmg_demo}/rtxmg.cpp (99%) rename {core => examples/rtxpt}/rtxpt.cpp (99%) rename {core => examples/sakura_forest_ser}/obj_model.cpp (99%) rename {core => examples/streamline_demo}/streamline.cpp (99%) rename examples/{ => streamline_demo}/streamline_demo.ts (99%) rename {core => examples/video_texture}/video_player.cpp (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba558c2b..b4bd8c8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,10 +187,10 @@ set(DONUT_PATCHES "${CMAKE_CURRENT_SOURCE_DIR}/patches/Donut-input-binding-set-vertex-buffer-change.patch" # SetDirectoryWithExecutable: GetDirectoryWithExecutable is where code looks for files next to the # executable, which under tslang's JIT is tslang.exe's folder, not bin/; rtxpt's run-time shader - # compiler (RTXPT_DIR's) finds ShaderDynamic/ there, so core/rtxpt.cpp points it at bin/. + # compiler (RTXPT_DIR's) finds ShaderDynamic/ there, so examples/rtxpt/rtxpt.cpp points it at bin/. "${CMAKE_CURRENT_SOURCE_DIR}/patches/Donut-executable-directory-override.patch" # DeviceCreationParameters::d3d12CreateDevice and createDxgiFactory2: D3D12's device and DXGI factory made by - # the application's functions when set, as core/streamline.cpp has Streamline's interposer make them (it is + # the application's functions when set, as examples/streamline_demo/streamline.cpp has Streamline's interposer make them (it is # loaded at run time from bin/streamline/, so its exports can't be linked in place of d3d12.lib and dxgi.lib); # and swapChainRecreationRequested / swapChainRecreation: D3D12's swap chain made again at a frame's start when # asked, as DLSS-G needs when it's turned on or off (loaded only while it's on). @@ -200,7 +200,7 @@ set(DONUT_PATCHES "${CMAKE_CURRENT_SOURCE_DIR}/patches/Donut-hidden-window.patch" # DeviceCreationParameters::recreateWindowSurfaceAfterDevice (Vulkan): the window's surface made again once the # device exists, as Streamline's interposer passes surface creation to its plugins (DLSS-G learns the window - # a swap chain presents to there) only once it has a device (core/streamline.cpp). + # a swap chain presents to there) only once it has a device (examples/streamline_demo/streamline.cpp). "${CMAKE_CURRENT_SOURCE_DIR}/patches/Donut-vulkan-surface-after-device.patch" # Android: the activity's window replaced by another (after the background, or the activity made # again for a configuration or theme change, which core/android_app_glue.c lives through): the @@ -313,7 +313,7 @@ set(DONUT_NVRHI_PATCHES # update on TLAS ... before the same TLAS was initially built"; partitioned_tlas -tlas). "${CMAKE_CURRENT_SOURCE_DIR}/patches/nvrhi-tlas-from-buffer-refit.patch" # rt::PipelineDesc::allowClusters sets D3D12's preview pipeline flag ALLOW_CLUSTERED_GEOMETRY also - # without NVRHI_D3D12_WITH_DXRCLUSTER, for cluster BLASes core/clas.cpp builds (clustered_geometry). + # without NVRHI_D3D12_WITH_DXRCLUSTER, for cluster BLASes examples/clustered_geometry/clas.cpp builds (clustered_geometry). "${CMAKE_CURRENT_SOURCE_DIR}/patches/nvrhi-d3d12-clustered-geometry-pipeline.patch" ) @@ -508,7 +508,7 @@ unset(CMAKE_POLICY_VERSION_MINIMUM) unset(CMAKE_PROJECT_zstd_INCLUDE_BEFORE) # RTX Mega Geometry's library (RTXMG_DIR/rtxmg: subdivision surfaces, cluster tessellation, cluster LOD, -# HiZ, its scene), built from the checkout against this Donut (the version RTXMG pins), for core/rtxmg.cpp. +# HiZ, its scene), built from the checkout against this Donut (the version RTXMG pins), for examples/rtxmg_demo/rtxmg.cpp. # Under the NVIDIA RTX SDKs License: built in place, nothing copied. Its CMake files read what RTXMG's root # CMakeLists.txt defines (DONUT_DIR, RTXMG_SHADER*), and link what it fetches (meshoptimizer, mimalloc, # implot); demo/envmap is added too, as rtxmg links its target. @@ -630,7 +630,7 @@ if (WITH_D3D12_PREVIEW_SDK AND WIN32 AND NVRHI_WITH_DX12) set_source_files_properties(core/d3d12_preview_sdk.cpp PROPERTIES COMPILE_DEFINITIONS DONUT_D3D12_PREVIEW_SDK_VERSION=${D3D12_PREVIEW_SDK_VERSION}) # The preview's clustered geometry operations (clustered_geometry). - set_source_files_properties(core/clas.cpp PROPERTIES + set_source_files_properties(examples/clustered_geometry/clas.cpp PROPERTIES COMPILE_DEFINITIONS DONUT_CLAS_WITH_D3D12_PREVIEW=1 INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/d3d12_preview") endif() @@ -695,7 +695,7 @@ endif() # NVIDIA Streamline 2.12.0 (github.com/NVIDIA-RTX/Streamline), for the streamline_demo example: its # interposer and plugins (DLSS, DLSS-RR, DeepDVC, Reflex/PCL, DLSS-G) are loaded at run time from -# bin/streamline/ by core/streamline.cpp. The release zip (~232 MB, headers + signed bin/x64) is fetched +# bin/streamline/ by examples/streamline_demo/streamline.cpp. The release zip (~232 MB, headers + signed bin/x64) is fetched # at configure time into the build folder (STREAMLINE_FETCH_DIR to share one). The SDK is MIT-licensed, but # the plugin and NGX DLLs in it are under NVIDIA's own licenses (license files next to them in bin/x64): # none of it may be committed here. Latewarp isn't in the 2.12.0 release (no sl.latewarp.dll or @@ -750,7 +750,7 @@ use_external_checkout(STREAMLINE_SAMPLE_DIR Streamline_Sample WHEN_EMPTY) # NVIDIA's Opacity Micro-Map SDK (github.com/NVIDIAGameWorks/Opacity-MicroMap-SDK): its GPU baker and # the baker's NVRHI layer (omm-lib, omm-gpu-nvrhi), for opacity_micromaps -bake, which bakes the -# micromaps at run time (core/omm_bake.cpp). Fetched at configure time into the build folder, with +# micromaps at run time (examples/opacity_micromaps/omm_bake.cpp). Fetched at configure time into the build folder, with # only the submodules omm-lib builds from (ShaderMake is Donut's). It's under the NVIDIA RTX SDKs # license (LICENSE.txt in it): nothing of it may be committed here. Its layer links nvrhi_d3d12, so # Windows only. @@ -816,10 +816,11 @@ add_library(donut_interop_static STATIC core/donut_interop.cpp) configure_donut_interop(donut_interop_static) # core/donut_interop.d.ts (with core/interop/*.d.ts, which it references) declares the functions -# core/*.cpp define, by hand: check that each declaration matches its definition, handle types +# core/*.cpp and examples/*/*.cpp define, by hand: check that each declaration matches its definition, handle types # included, and that no handle is a void*, before building the C++. find_package(Python3 REQUIRED COMPONENTS Interpreter) -file(GLOB INTEROP_CPP_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/core/*.cpp") +file(GLOB INTEROP_CPP_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/core/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/examples/*/*.cpp") file(GLOB INTEROP_DECLARATIONS CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/core/interop/*.d.ts") add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/check_interop_types.stamp" @@ -836,7 +837,7 @@ add_custom_command( add_custom_target(check_interop_types DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/check_interop_types.stamp") add_dependencies(donut_interop_static check_interop_types) -# miniaudio (one header, public domain or MIT-0): the playback device of core/web_audio.cpp (the +# miniaudio (one header, public domain or MIT-0): the playback device of examples/golden_line/web_audio.cpp (the # golden_line example's sound), as core/nri's (the same tag). Its own CMake project isn't used. include(FetchContent) FetchContent_Declare(miniaudio @@ -845,7 +846,7 @@ FetchContent_Declare(miniaudio GIT_SHALLOW TRUE SOURCE_SUBDIR header-only) FetchContent_MakeAvailable(miniaudio) -set_source_files_properties(core/web_audio.cpp PROPERTIES INCLUDE_DIRECTORIES "${miniaudio_SOURCE_DIR}") +set_source_files_properties(examples/golden_line/web_audio.cpp PROPERTIES INCLUDE_DIRECTORIES "${miniaudio_SOURCE_DIR}") if (NOT WIN32) # miniaudio loads the audio backends at run time (dlopen) and renders on a thread of its own find_package(Threads REQUIRED) @@ -865,51 +866,51 @@ endif() # transcoder, the fast block compressor, the paged images, the PTLAS builds (on D3D12 the JIT gets # the pinned Agility SDK, not the preview: Vulkan only), and (Windows) the video player. set(JIT_MODULE_SOURCES - core/obj_model.cpp + examples/sakura_forest_ser/obj_model.cpp core/sdkmesh.cpp core/meshlet_model.cpp core/directx_collision.cpp core/basis_transcoder.cpp - core/fast_block_compress.cpp - core/fbc_cpu.cpp - core/paged_images.cpp - core/omm_bake.cpp + examples/fast_block_compress/fast_block_compress.cpp + examples/fast_block_compress/fbc_cpu.cpp + examples/memory_management/paged_images.cpp + examples/opacity_micromaps/omm_bake.cpp core/ptlas.cpp - core/clas.cpp - core/msvc_fast_math.cpp - core/web_audio.cpp) + examples/clustered_geometry/clas.cpp + examples/raytracing_mini_engine/msvc_fast_math.cpp + examples/golden_line/web_audio.cpp) if (WIN32) # denoised_rtao is Windows only (its PBRT parser includes windows.h, it decodes with WIC). - list(APPEND JIT_MODULE_SOURCES core/denoised_rtao.cpp core/pbrt/PBRTParser.cpp core/pbrt/PlyParser.cpp - core/video_player.cpp) + list(APPEND JIT_MODULE_SOURCES examples/denoised_rtao/denoised_rtao.cpp examples/denoised_rtao/pbrt/PBRTParser.cpp examples/denoised_rtao/pbrt/PlyParser.cpp + examples/video_texture/video_player.cpp) endif() if (OMM_SDK_LIBRARIES) - set_source_files_properties(core/omm_bake.cpp PROPERTIES COMPILE_DEFINITIONS DONUT_WITH_OMM_SDK=1) + set_source_files_properties(examples/opacity_micromaps/omm_bake.cpp PROPERTIES COMPILE_DEFINITIONS DONUT_WITH_OMM_SDK=1) endif() if (RTXPT_DIR) - list(APPEND JIT_MODULE_SOURCES core/rtxpt.cpp) + list(APPEND JIT_MODULE_SOURCES examples/rtxpt/rtxpt.cpp) endif() if (RTXDI_DIR) if (RTXPT_DIR) message(FATAL_ERROR "RTXDI_DIR and RTXPT_DIR cannot both be set: RTXPT bundles its own RTXDI library, which would clash with RTXDI_DIR's (configure one example family per build directory)") endif() - # The glue to RTXDI (core/rtxdi.cpp) and to the Minimal Sample's shaders (core/rtxdi_minimal.cpp), linked + # The glue to RTXDI (examples/rtxdi_minimal/rtxdi.cpp) and to the Minimal Sample's shaders (examples/rtxdi_minimal/rtxdi_minimal.cpp), linked # into rtxdi_minimal, and into donut_interop_shared for the JIT. - set(RTXDI_GLUE_SOURCES core/rtxdi.cpp core/rtxdi_minimal.cpp) + set(RTXDI_GLUE_SOURCES examples/rtxdi_minimal/rtxdi.cpp examples/rtxdi_minimal/rtxdi_minimal.cpp) list(APPEND JIT_MODULE_SOURCES ${RTXDI_GLUE_SOURCES}) endif() if (RTXMG_DIR) - # core/rtxmg.cpp includes RTXMG's library and demo headers (C++23) and the demo's HiZ prepass, built in place. - set(RTXMG_GLUE_SOURCES core/rtxmg.cpp "${RTXMG_DIR}/demo/zrenderer.cpp") + # examples/rtxmg_demo/rtxmg.cpp includes RTXMG's library and demo headers (C++23) and the demo's HiZ prepass, built in place. + set(RTXMG_GLUE_SOURCES examples/rtxmg_demo/rtxmg.cpp "${RTXMG_DIR}/demo/zrenderer.cpp") list(APPEND JIT_MODULE_SOURCES ${RTXMG_GLUE_SOURCES}) set_source_files_properties(${RTXMG_GLUE_SOURCES} PROPERTIES INCLUDE_DIRECTORIES "${RTXMG_DIR}/demo;${RTXMG_DIR}/rtxmg/include;${RTXMG_DIR};${RTXMG_DIR}/extern" COMPILE_OPTIONS "$,/std:c++latest;/wd5333,-std=c++23>") endif() if (STREAMLINE_INCLUDE_DIR) - # Streamline's headers only: its interposer is loaded at run time (core/streamline.cpp). - list(APPEND JIT_MODULE_SOURCES core/streamline.cpp) - set_source_files_properties(core/streamline.cpp PROPERTIES INCLUDE_DIRECTORIES "${STREAMLINE_INCLUDE_DIR}") + # Streamline's headers only: its interposer is loaded at run time (examples/streamline_demo/streamline.cpp). + list(APPEND JIT_MODULE_SOURCES examples/streamline_demo/streamline.cpp) + set_source_files_properties(examples/streamline_demo/streamline.cpp PROPERTIES INCLUDE_DIRECTORIES "${STREAMLINE_INCLUDE_DIR}") endif() if (RTXCR_DIR) list(APPEND JIT_MODULE_SOURCES core/rtxcr.cpp) @@ -3763,7 +3764,7 @@ add_tslang_example(golden_line examples/golden_line/golden_line_world.ts example examples/golden_line/golden_line_signs.ts examples/golden_line/golden_line_shadowfit.ts examples/golden_line/golden_line_shadows.ts examples/golden_line/golden_line_puffs.ts examples/golden_line/golden_line_plume.ts examples/golden_line/golden_line_steam.ts examples/golden_line/golden_line_birds.ts examples/golden_line/golden_line_motes.ts examples/golden_line/golden_line_bloom.ts examples/golden_line/golden_line_shots.ts - examples/golden_line/golden_line_hud.ts examples/golden_line/golden_line_soundbank.ts examples/golden_line/golden_line_sound.ts examples/golden_line/web_audio.ts core/web_audio.cpp) + examples/golden_line/golden_line_hud.ts examples/golden_line/golden_line_soundbank.ts examples/golden_line/golden_line_sound.ts examples/golden_line/web_audio.ts examples/golden_line/web_audio.cpp) target_link_libraries(golden_line PRIVATE ${WEB_AUDIO_LIBRARIES}) add_tslang_example_test(golden_line) add_tslang_example_test(golden_line SUFFIX cab ARGS -shot cab) @@ -4056,7 +4057,7 @@ endif() # Port of the Xbox ATG FastBlockCompress sample (github.com/microsoft/Xbox-ATG-Samples, # XDKSamples/Graphics/FastBlockCompress): BC1, BC3 and BC5 compression at run time in compute shaders # (into R32G32_UINT / R32G32B32A32_UINT textures copied into BC textures) or on the CPU (the sample's -# SSE2 compressor, core/fbc_cpu.cpp), compared with offline BC and BC7 versions side by side, RMS +# SSE2 compressor, examples/fast_block_compress/fbc_cpu.cpp), compared with offline BC and BC7 versions side by side, RMS # errors and timings shown. Its images are the sample's, not in this repo: point # XBOX_ATG_SAMPLES_DIR at an Xbox-ATG-Samples checkout. set(XBOX_ATG_SAMPLES_DIR "" CACHE PATH "Xbox-ATG-Samples checkout (github.com/microsoft/Xbox-ATG-Samples)") @@ -4072,7 +4073,7 @@ donut_compile_shaders_all_platforms( ${CMAKE_CURRENT_SOURCE_DIR}/shaders/fast_block_compress_quad.hlsl OUTPUT_BASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/fast_block_compress ) -add_tslang_example(fast_block_compress core/text_format.ts examples/fast_block_compress/fbc_texture.ts core/fast_block_compress.cpp core/fbc_cpu.cpp MEDIA fast_block_compress) +add_tslang_example(fast_block_compress core/text_format.ts examples/fast_block_compress/fbc_texture.ts examples/fast_block_compress/fast_block_compress.cpp examples/fast_block_compress/fbc_cpu.cpp MEDIA fast_block_compress) add_tslang_example_test(fast_block_compress) if (XBOX_ATG_SAMPLES_DIR) set(fbc_media) @@ -4115,7 +4116,7 @@ add_tslang_nri_example(simple_hdr_nri SHADERS simple_hdr_shaders core/text_forma add_tslang_example_test(simple_hdr_nri) # Port of the Xbox ATG VideoTexturePC12 sample (PCSamples/Graphics/VideoTexturePC12): a video played -# by Media Foundation's Media Engine (core/video_player.cpp) into a texture shared with the app's +# by Media Foundation's Media Engine (examples/video_texture/video_player.cpp) into a texture shared with the app's # device (D3D12, D3D11; through memory on Vulkan), on a spinning lit cube or as a sprite. Windows # only; mfplat.dll is delay-loaded (Windows N editions lack it). The video is the sample's # (XBOX_ATG_SAMPLES_DIR above), the text's font DONUT_SAMPLES_MEDIA_DIR's. @@ -4127,7 +4128,7 @@ if (WIN32) SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/shaders/video_texture.hlsl OUTPUT_BASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/video_texture ) - add_tslang_example(video_texture core/matrix.ts examples/video_texture/video_player.ts core/video_player.cpp MEDIA fonts video_texture) + add_tslang_example(video_texture core/matrix.ts examples/video_texture/video_player.ts examples/video_texture/video_player.cpp MEDIA fonts video_texture) add_tslang_example_test(video_texture) target_link_libraries(video_texture PRIVATE delayimp) target_link_options(video_texture PRIVATE /DELAYLOAD:mfplat.dll) @@ -4482,7 +4483,7 @@ endfunction() # path), Vulkan VK_EXT_opacity_micromap. Its model, micromaps and textures (~190 MB) are the # sample's: point DIRECTX_GRAPHICS_SAMPLES_DIR at a DirectX-Graphics-Samples checkout. With -bake # (WITH_OMM_SDK) the micromaps are baked at run time instead, by the Opacity Micro-Map SDK's GPU -# baker (core/omm_bake.cpp). +# baker (examples/opacity_micromaps/omm_bake.cpp). donut_compile_shaders( TARGET opacity_micromaps_shaders PROJECT_NAME "Opacity Micromaps" @@ -4492,10 +4493,10 @@ donut_compile_shaders( SPIRV_DXC ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/opacity_micromaps/spirv ) if (NVRHI_WITH_DX12) - add_tslang_example(opacity_micromaps core/directx_math.ts examples/opacity_micromaps/omm_bake.ts core/omm_bake.cpp core/d3d12_agility_sdk.cpp + add_tslang_example(opacity_micromaps core/directx_math.ts examples/opacity_micromaps/omm_bake.ts examples/opacity_micromaps/omm_bake.cpp core/d3d12_agility_sdk.cpp MEDIA fonts opacity_micromaps) else() - add_tslang_example(opacity_micromaps core/directx_math.ts examples/opacity_micromaps/omm_bake.ts core/omm_bake.cpp MEDIA fonts opacity_micromaps) + add_tslang_example(opacity_micromaps core/directx_math.ts examples/opacity_micromaps/omm_bake.ts examples/opacity_micromaps/omm_bake.cpp MEDIA fonts opacity_micromaps) endif() target_link_libraries(opacity_micromaps PRIVATE ${OMM_SDK_LIBRARIES}) add_tslang_example_test(opacity_micromaps) @@ -4575,7 +4576,7 @@ add_tslang_example_test(partitioned_tlas SUFFIX mode2 APIS vk ARGS -mode 2) # Port of DirectX-Graphics-Samples' D3D12RaytracingClusteredGeometry: spheres, a torus, a cube, a Klein # bottle and a glass slab floor decomposed into clusters of up to 256 triangles, each a CLAS built by -# GPU-driven operations (core/clas.cpp), each object a cluster BLAS of its CLASes; an animated sphere's +# GPU-driven operations (examples/clustered_geometry/clas.cpp), each object a cluster BLAS of its CLASes; an animated sphere's # CLASes instantiated every frame from cluster templates and its deformed vertices; a spiral of clones; # glass, chrome and per-cluster colors through ClusterID(). D3D12's preview (as partitioned_tlas) and # the preview DXC's shader model 6.10, or Vulkan's VK_NV_cluster_acceleration_structure (no COMPRESSED1 @@ -4602,7 +4603,7 @@ donut_compile_shaders( ) if (D3D12_PREVIEW_SDK_VERSION AND DXC_PREVIEW_PATH) # core/ptlas.cpp: Donut_EnableD3D12RaytracingPreview. - add_tslang_example(clustered_geometry core/directx_math.ts core/text_format.ts examples/clustered_geometry/clas.ts core/clas.cpp core/ptlas.cpp core/d3d12_preview_sdk.cpp) + add_tslang_example(clustered_geometry core/directx_math.ts core/text_format.ts examples/clustered_geometry/clas.ts examples/clustered_geometry/clas.cpp core/ptlas.cpp core/d3d12_preview_sdk.cpp) add_tslang_example_test(clustered_geometry APIS dx12) # The traditional path (a DXR1 BLAS per object), COMPRESSED1 vertices, and settings switched while it # runs (rebuilds: traditional and back, 1000 clones, CLASes sized first). @@ -4611,7 +4612,7 @@ if (D3D12_PREVIEW_SDK_VERSION AND DXC_PREVIEW_PATH) add_tslang_example_test(clustered_geometry SUFFIX switches APIS dx12 ARGS -at 1:geom-traditional -at 2:geom-clusters -at 2:extra-1k -at 3:alloc-getsizes) else() - add_tslang_example(clustered_geometry core/directx_math.ts core/text_format.ts examples/clustered_geometry/clas.ts core/clas.cpp core/ptlas.cpp) + add_tslang_example(clustered_geometry core/directx_math.ts core/text_format.ts examples/clustered_geometry/clas.ts examples/clustered_geometry/clas.cpp core/ptlas.cpp) endif() add_dependencies(clustered_geometry clustered_geometry_spirv_shaders) add_tslang_example_test(clustered_geometry APIS vk) @@ -4648,7 +4649,7 @@ donut_compile_shaders( SPIRV_DXC ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/raytracing_mini_engine/spirv SHADERMAKE_OPTIONS "--hlsl2021" ) -add_tslang_example(raytracing_mini_engine core/directx_math.ts core/msvc_fast_math.cpp) +add_tslang_example(raytracing_mini_engine core/directx_math.ts examples/raytracing_mini_engine/msvc_fast_math.cpp) add_dependencies(raytracing_mini_engine raytracing_mini_engine_raster_shaders) if (DIRECTX_GRAPHICS_SAMPLES_DIR) set(sponza_dir "Samples/Desktop/D3D12Raytracing/src/D3D12RaytracingMiniEngineSample/Sponza") @@ -4873,7 +4874,7 @@ endfunction() # ambient occlusion at one ray per pixel, denoised spatio-temporally (reverse reprojection into a # temporal cache, variance-guided blending, an edge-stopping a-trous filter, a disocclusion blur), # over a scene of PBRT models (a house, cars, a dragon, a spaceship: the sample's parser, in -# core/pbrt) and procedural grass a compute shader regenerates every frame; a specular path tracer +# examples/denoised_rtao/pbrt) and procedural grass a compute shader regenerates every frame; a specular path tracer # makes the G-buffer. Its assets (~140 MB) are the sample's, from DIRECTX_GRAPHICS_SAMPLES_DIR. # Ray tracing pipelines: D3D12 or Vulkan. Windows only: the textures are loaded through WIC, and the # PBRT parser takes its definitions from windows.h. @@ -4888,7 +4889,7 @@ if (WIN32) SPIRV_DXC ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/denoised_rtao/spirv SHADERMAKE_OPTIONS_SPIRV "--vulkanMemoryLayout dx" ) - add_tslang_example(denoised_rtao core/directx_math.ts examples/denoised_rtao/pbrt_scene.ts core/denoised_rtao.cpp core/pbrt/PBRTParser.cpp core/pbrt/PlyParser.cpp + add_tslang_example(denoised_rtao core/directx_math.ts examples/denoised_rtao/pbrt_scene.ts examples/denoised_rtao/denoised_rtao.cpp examples/denoised_rtao/pbrt/PBRTParser.cpp examples/denoised_rtao/pbrt/PlyParser.cpp MEDIA denoised_rtao) add_dxgs_media_directory(denoised_rtao denoised_rtao Samples/Desktop/D3D12Raytracing/src/D3D12RaytracingRealTimeDenoisedAmbientOcclusion/Assets) @@ -5043,7 +5044,7 @@ endif() # traced into hit objects and reordered (MaybeReorderThread) by the hit, a reflection hint, or both. # D3D12 only (shader model 6.9 hit objects, the Agility SDK runtime); the state object comes from # the DXIL library's subobjects (the sample builds them in C++), its OBJ models load with the -# sample's loader (core/obj_model.cpp). Its models and textures come from DIRECTX_GRAPHICS_SAMPLES_DIR, +# sample's loader (examples/sakura_forest_ser/obj_model.cpp). Its models and textures come from DIRECTX_GRAPHICS_SAMPLES_DIR, # a checkout from August 2025 or later (the sample is newer than some). The tests fix the # random forest's seeds and run each sort mode. if (NVRHI_WITH_DX12) @@ -5057,7 +5058,7 @@ if (NVRHI_WITH_DX12) DXIL ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/sakura_forest_ser/dxil SHADER_MODEL 6_9 ) - add_tslang_example(sakura_forest_ser core/directx_math.ts examples/sakura_forest_ser/obj_model.ts core/obj_model.cpp core/d3d12_agility_sdk.cpp + add_tslang_example(sakura_forest_ser core/directx_math.ts examples/sakura_forest_ser/obj_model.ts examples/sakura_forest_ser/obj_model.cpp core/d3d12_agility_sdk.cpp MEDIA fonts) set(sakura_dir "Samples/Desktop/D3D12Raytracing/src/D3D12RaytracingSakuraForestSER") if (DIRECTX_GRAPHICS_SAMPLES_DIR AND NOT EXISTS "${DIRECTX_GRAPHICS_SAMPLES_DIR}/${sakura_dir}") @@ -5075,7 +5076,7 @@ endif() # 4096 x 4096 generated checkerboards) streamed into video memory a mip level at a time under the # process's DXGI budget: reserved textures, each level backed by heaps of its own, mapped and filled # on a copy queue by a paging thread that makes them resident again (MakeResident) or evicts them -# (Evict) by priority (core/paged_images.cpp). D3D12 only. TileGrid.dds comes from +# (Evict) by priority (examples/memory_management/paged_images.cpp). D3D12 only. TileGrid.dds comes from # DIRECTX_GRAPHICS_SAMPLES_DIR (without it, only the generated images). The tests: everything paged # in under the kernel's budget (a 16 GB card's), paging under a 512 MB override, and trimming to it # once everything is in. @@ -5087,7 +5088,7 @@ if (NVRHI_WITH_DX12) SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/shaders/memory_management.hlsl DXIL ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/memory_management/dxil ) - add_tslang_example(memory_management examples/memory_management/paged_images.ts core/paged_images.cpp MEDIA fonts) + add_tslang_example(memory_management examples/memory_management/paged_images.ts examples/memory_management/paged_images.cpp MEDIA fonts) add_dxgs_media(memory_management memory_management TechniqueDemos/D3D12MemoryManagement/src/TileGrid.dds) add_tslang_example_test(memory_management APIS dx12) add_tslang_example_test(memory_management SUFFIX budget APIS dx12 ARGS -budget 512) @@ -5493,7 +5494,7 @@ endif() # Under the NVIDIA RTX SDKs License like RTXCR, so nothing of it is copied here: with RTXPT_DIR set to # a checkout, the sample's renderer library (scene, materials, lights, environment map, the path tracer's # run-time pipeline baker, tone mapping, accumulation: rtxpt_core) and its shaders compile in place; -# examples/rtxpt/rtxpt.ts is the sample's host (Sample.cpp) and core/rtxpt.cpp the glue. +# examples/rtxpt/rtxpt.ts is the sample's host (Sample.cpp) and examples/rtxpt/rtxpt.cpp the glue. if (RTXPT_DIR) # Tracy's headers: RTXPT's code marks profiler zones, which are empty without TRACY_ENABLE. FetchContent_Declare(tracy @@ -5559,7 +5560,7 @@ if (RTXPT_DIR) target_compile_definitions(rtxpt_core PUBLIC RTXPT_D3D12_WITH_NVAPI=0 RTXPT_D3D_AGILITY_SDK_VERSION=${DONUT_D3D_AGILITY_SDK_VERSION}) set(RTXPT_GLUE_INCLUDES "${RTXPT_SOURCE_DIR};${RTXPT_DIR}/External;${RTXPT_DIR}/External/Rtxdi/Include;${RTXPT_DIR}/External/Nrd/Include;${RTXPT_DIR}/External/cxxopts/include;${tracy_SOURCE_DIR}/public") - set_source_files_properties(core/rtxpt.cpp PROPERTIES + set_source_files_properties(examples/rtxpt/rtxpt.cpp PROPERTIES INCLUDE_DIRECTORIES "${RTXPT_GLUE_INCLUDES}" COMPILE_DEFINITIONS "RTXPT_D3D12_WITH_NVAPI=0;RTXPT_D3D_AGILITY_SDK_VERSION=${DONUT_D3D_AGILITY_SDK_VERSION}" COMPILE_OPTIONS "$,/std:c++20,-std=c++20>") @@ -5606,7 +5607,7 @@ if (RTXPT_DIR) # The path tracer's shaders compile at run time (a permutation per material and setting), by the DXC # of RTXPT's checkout, from bin/ShaderDynamic/: the layout RTXPT's ShaderCompilerUtils looks for - # next to the executable (core/rtxpt.cpp makes that bin/ under the JIT too). Donut's shader headers + # next to the executable (examples/rtxpt/rtxpt.cpp makes that bin/ under the JIT too). Donut's shader headers # are this repository's, which the C++ side's structures (materials, lights) come from. set(RTXPT_DYNAMIC_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ShaderDynamic") set(RTXPT_DXC_DIR "${RTXPT_DIR}/External/dxc/build/native/bin/x64") @@ -5632,9 +5633,9 @@ if (RTXPT_DIR) # The path tracer is shader model 6.9 on D3D12 (DXR 1.2's hit objects): the Agility SDK runtime. if (NVRHI_WITH_DX12) - add_tslang_example(rtxpt examples/rtxpt/rtxpt_renderer.ts core/rtxpt_game.ts core/rtxpt.cpp core/d3d12_agility_sdk.cpp MEDIA fonts) + add_tslang_example(rtxpt examples/rtxpt/rtxpt_renderer.ts core/rtxpt_game.ts examples/rtxpt/rtxpt.cpp core/d3d12_agility_sdk.cpp MEDIA fonts) else() - add_tslang_example(rtxpt examples/rtxpt/rtxpt_renderer.ts core/rtxpt_game.ts core/rtxpt.cpp MEDIA fonts) + add_tslang_example(rtxpt examples/rtxpt/rtxpt_renderer.ts core/rtxpt_game.ts examples/rtxpt/rtxpt.cpp MEDIA fonts) endif() add_dependencies(rtxpt rtxpt_shaders rtxpt_nrd_shaders rtxpt_dynamic_shaders) target_link_libraries(rtxpt PRIVATE rtxpt_core) @@ -5687,11 +5688,11 @@ if (RTXDI_DIR) set_target_properties(rtxdi_runtime PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON POSITION_INDEPENDENT_CODE ON) target_include_directories(rtxdi_runtime PUBLIC ${RTXDI_DIR}/Libraries/Rtxdi/Include) - # The glue includes the library's headers; core/rtxdi_minimal.cpp also the Minimal Sample's - # ShaderParameters.h in place (it declares the structures the shaders read), core/rtxdi.cpp doesn't. - set_source_files_properties(core/rtxdi.cpp PROPERTIES + # The glue includes the library's headers; examples/rtxdi_minimal/rtxdi_minimal.cpp also the Minimal Sample's + # ShaderParameters.h in place (it declares the structures the shaders read), examples/rtxdi_minimal/rtxdi.cpp doesn't. + set_source_files_properties(examples/rtxdi_minimal/rtxdi.cpp PROPERTIES INCLUDE_DIRECTORIES "${RTXDI_DIR}/Libraries/Rtxdi/Include") - set_source_files_properties(core/rtxdi_minimal.cpp PROPERTIES + set_source_files_properties(examples/rtxdi_minimal/rtxdi_minimal.cpp PROPERTIES INCLUDE_DIRECTORIES "${RTXDI_DIR}/Libraries/Rtxdi/Include;${RTXDI_DIR}/Samples/MinimalSample/Shaders") if (TARGET donut_interop_shared) target_link_libraries(donut_interop_shared PRIVATE rtxdi_runtime) @@ -5791,7 +5792,7 @@ if (RTXMG_DIR) --media ${RTXMG_DIR}/assets --scene subdivision/amy_kitchenset.scene.json) endif() -# NVIDIA Streamline (WITH_STREAMLINE above): core/streamline.cpp starts it from bin/streamline/ and hooks the +# NVIDIA Streamline (WITH_STREAMLINE above): examples/streamline_demo/streamline.cpp starts it from bin/streamline/ and hooks the # device's creation (AppOptions.Streamline); D3D12 and Vulkan. # The frame is the Streamline Sample's (STREAMLINE_SAMPLE_DIR above), whose shaders compile in place: its # ray generation library (REFLECT_MATERIALS 1 on D3D12, 0 on Vulkan, as the sample loads them) and the UI @@ -5808,7 +5809,7 @@ if (WITH_STREAMLINE AND WIN32 AND STREAMLINE_SAMPLE_DIR) SHADERMAKE_OPTIONS "--sourceDir ${STREAMLINE_SAMPLE_DIR}/src" SHADERMAKE_OPTIONS_SPIRV "--tRegShift 200 --sRegShift 128 --bRegShift 300 --uRegShift 400" ) - add_tslang_example(streamline_demo core/matrix.ts core/streamline.cpp MEDIA fonts sponza-plus.scene.json glTF-Sample-Assets) + add_tslang_example(streamline_demo core/matrix.ts examples/streamline_demo/streamline.cpp MEDIA fonts sponza-plus.scene.json glTF-Sample-Assets) add_dependencies(streamline_demo copy_streamline_binaries) # DLSS, DLSS-RR, DeepDVC and Reflex supported, or skipped (no RTX GPU, old driver); then without # Streamline (-slDisable), where nothing may report supported: always skipped, failed otherwise. Both @@ -5816,7 +5817,7 @@ if (WITH_STREAMLINE AND WIN32 AND STREAMLINE_SAMPLE_DIR) add_tslang_example_test(streamline_demo ARGS -width 1280 -height 720) add_tslang_example_test(streamline_demo SUFFIX sl_disabled ARGS -width 1280 -height 720 -slDisable) # Reflex low latency with DLSS. On Vulkan under the validation layer its sleep (NvLowLatencyVk) crashed in the - # driver unless the layer's handle wrapping is off, which core/streamline.cpp sees to. + # driver unless the layer's handle wrapping is off, which examples/streamline_demo/streamline.cpp sees to. add_tslang_example_test(streamline_demo SUFFIX reflex ARGS -width 1280 -height 720 -reflex 1 -dlss 3) # The sample's frame 120 at its size, in its scene, one test per lighting / anti-aliasing mode of its # reference frames (ray traced, deferred, TAA), each saving its frame (bin/streamline_demo__.png) diff --git a/README.md b/README.md index 19884d99..0059fa1d 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ Ported from [Microsoft DirectX-Graphics-Samples](https://github.com/microsoft/Di Reserved Resources (TypeScript, DirectX 12 / Vulkan). One level of a tiled texture at a time mapped to memory, picked with the arrow keys
Reserved Resources
One level of a tiled texture at a time mapped to memory, picked with the arrow keys.Raytracing Library Subobjects (TypeScript, DirectX 12). A ray traced cube whose root signatures, hit group and configs are defined in its HLSL
Raytracing Library Subobjects
A ray traced cube whose root signatures, hit group and configs are defined in its HLSL (D3D12 only).Generic Programs (TypeScript, DirectX 12). Two triangles drawn with generic programs, graphics pipelines made as state objects
Generic Programs
Two triangles drawn with generic programs: graphics pipelines made as state objects (D3D12 only). Sakura Forest SER (TypeScript, DirectX 12). A ray traced sakura forest of 13525 instances whose primary rays are reordered with Shader Execution Reordering
Sakura Forest SER
A ray traced sakura forest whose primary rays go through hit objects and Shader Execution Reordering (D3D12 only).Memory Management (TypeScript, DirectX 12). Large images streamed into video memory a mip level at a time under the memory budget, with mip overlays and a memory graph
Memory Management
Images streamed a mip level at a time under the memory budget: tiled resources, MakeResident / Evict, a paging thread (DirectX 12 only).Raytracing Hello World (TypeScript, DirectX 12 / Vulkan). One triangle ray traced in screen space, showing the hit barycentrics inside a stencil window
Raytracing Hello World
One triangle ray traced in screen space: hit barycentrics inside a stencil window, dispatch coordinates around it. Raytracing Hello SER (TypeScript, DirectX 12 / Vulkan). A full screen quad ray traced with hit objects, every fourth column of rays doing extra work and reordered by it
Raytracing Hello SER
Shader Execution Reordering at its simplest: hit objects, threads reordered by a heavy/light work hint (-noreorder to compare).Partitioned TLAS Dominoes (TypeScript, DirectX 12 preview / Vulkan). A grid of dominoes toppled by GPU physics, a partitioned TLAS updated by instance writes the GPU counts, colored by partition
Partitioned TLAS Dominoes
Dominoes toppled by GPU physics, a partitioned TLAS updated in place by GPU-counted instance writes (or a refitted TLAS), sketch-style compositing. Needs what ptlas needs.Clustered Geometry (TypeScript, DirectX 12 preview / Vulkan). Glass and chrome spheres, a torus, a cube and a Klein bottle on a glass checker slab, a spiral of clones, every cluster in a color of its own
Clustered Geometry
Objects split into clusters of up to 256 triangles, a CLAS each and a cluster BLAS per object, built by GPU-driven operations; an animated sphere instantiated from cluster templates every frame; per-cluster colors by ClusterID() (shader model 6.10); the sample's traditional-BLAS comparison, COMPRESSED1 vertices, allocation and rebuild modes on keys. D3D12 preview, as ptlas, or Vulkan with VK_NV_cluster_acceleration_structure (FLOAT32_3 vertices only). -Raytracing MiniEngine (TypeScript, DirectX 12 / Vulkan). Sponza ray traced: diffuse hit shading with the sun's shadow map, sunlit floor and banners
Raytracing MiniEngine
MiniEngine's Sponza (its sponza.h3d) as a BLAS per mesh and the sample's seven modes on keys 1 to 7: rasterized, barycentrics of primary and reflection rays, shadow rays, diffuse hit shading with shadow maps or shadow rays, reflections. MiniEngine's frame around it too (depth prepass, shadow map, SSAO, its TAA blend and sharpening): every mode matches the sample bit for bit on D3D12; its point lights and particles left out. +Raytracing MiniEngine (TypeScript, DirectX 12 / Vulkan). Sponza ray traced: diffuse hit shading with the sun's shadow map, sunlit floor and banners
Raytracing MiniEngine
MiniEngine's Sponza (its sponza.h3d) as a BLAS per mesh and the sample's seven modes on keys 1 to 7: rasterized, barycentrics of primary and reflection rays, shadow rays, diffuse hit shading with shadow maps or shadow rays, reflections. MiniEngine's frame around it too (depth prepass, shadow map, SSAO, its TAA blend and sharpening): every mode matches the sample bit for bit on D3D12; its point lights and particles left out. ### Xbox ATG Samples ports @@ -280,7 +280,7 @@ characters in a checkout below a deep folder (a worktree, for example). `opacity_micromaps -bake` bakes the tree's opacity micromaps at run time instead of loading the sample's files, with the GPU baker of NVIDIA's [Opacity Micro-Map SDK](https://github.com/NVIDIAGameWorks/Opacity-MicroMap-SDK) -(`core/omm_bake.cpp`, D3D12 and Vulkan). The SDK is under the NVIDIA RTX SDKs License, so it is fetched at configure +(`examples/opacity_micromaps/omm_bake.cpp`, D3D12 and Vulkan). The SDK is under the NVIDIA RTX SDKs License, so it is fetched at configure time into the build folder rather than committed (`WITH_OMM_SDK`, on by default; Windows). `-subd <1-12>` and `-2state` pick the set to start with, `-bakeScale ` sets the SDK's dynamic subdivision scale (2 by default, which reproduces the files' subdivision levels), and `-noAhs` / `-showAhs` turn the any-hit shader off or show where it ran. @@ -326,7 +326,7 @@ motion vectors. and Vulkan), built the same way from a checkout: the sample is under the NVIDIA RTX SDKs License, so nothing of it is copied here. With `-DRTXPT_DIR=` (submodules and assets pulled, and configured once by its own CMake, which downloads the DXC its run-time shader compiler uses) the sample's renderer library, its shaders and -its NRD compile where they are, `core/rtxpt.cpp` drives them and `examples/rtxpt/rtxpt.ts` is the sample's host +its NRD compile where they are, `examples/rtxpt/rtxpt.cpp` drives them and `examples/rtxpt/rtxpt.ts` is the sample's host (settings, camera, UI). The `default-rtxpt` and `release-rtxpt` presets build into `build-rtxpt` and `build-release-rtxpt`: @@ -383,7 +383,7 @@ and BLASes rebuilt on the GPU, HiZ-culled, path traced with accumulation and ton is under the NVIDIA RTX SDKs License too, so it is built the same way: with `-DRTXMG_DIR=` (submodules and assets pulled, and configured once by its own CMake) its library (`rtxmg`, with OpenSubdiv's `osd_lite` and the demo's environment map) builds from the checkout against this repository's Donut, the demo's shaders compile -in place (`shaders/rtxmg_demo.cfg` names them), `core/rtxmg.cpp` drives the library (scene, cluster tessellator, +in place (`shaders/rtxmg_demo.cfg` names them), `examples/rtxmg_demo/rtxmg.cpp` drives the library (scene, cluster tessellator, HiZ, TLAS, environment map sampling) and `examples/rtxmg_demo/rtxmg_demo.ts` is the demo's app (the path tracer's pipeline, shader table and bindings, the trace, the blit, the window). The `default-rtxmg` and `release-rtxmg` presets build into `build-rtxmg` and `build-release-rtxmg` (`run_rtxmg.bat` runs the Release build): @@ -423,7 +423,7 @@ D3D12 and Vulkan): the Arcade scene lit only by its emissive triangles, with ReS (primary rays, initial light sampling, spatio-temporal resampling, shading, with ray traced visibility). RTXDI is under the NVIDIA RTX SDKs License, so (as with RTXPT) nothing of it is copied here: `-DRTXDI_DIR=` (with its assets pulled) builds the RTXDI runtime library from the checkout (`rtxdi_runtime`), compiles the sample's shaders in place -(`shaders/rtxdi_minimal.cfg` names them), `core/rtxdi.cpp` drives the library, `core/rtxdi_minimal.cpp` lays out the +(`shaders/rtxdi_minimal.cfg` names them), `examples/rtxdi_minimal/rtxdi.cpp` drives the library, `examples/rtxdi_minimal/rtxdi_minimal.cpp` lays out the buffers the sample's shaders read, and `examples/rtxdi_minimal/rtxdi_di.ts` and `examples/rtxdi_minimal/rtxdi_minimal.ts` are the sample's host (the light preparation pass, the render pass, the settings window), written in this repository with the sample's values and behaviour. The scene loads from the checkout's `Assets` (linked next to `bin/`) before the first frame, where the @@ -567,7 +567,7 @@ tslang --emit=jit --shared-libs=build/bin/donut_interop_shared.dll examples/basi pre-alpha94 or later: pre-alpha93's cache crashed a run that compiled two or more modules ([TypeScriptCompiler#548](https://github.com/ASDAlexander77/TypeScriptCompiler/pull/548)). - The shared library also holds the C++ modules some examples link (`core/sdkmesh.cpp`, - `core/meshlet_model.cpp`, `core/paged_images.cpp`, ...), and applies the D3D12 Agility SDK + `core/meshlet_model.cpp`, `examples/memory_management/paged_images.cpp`, ...), and applies the D3D12 Agility SDK runtime from `bin/D3D12` (the executables that need it opt in through their exports, which `tslang.exe` doesn't have). diff --git a/core/donut.ts b/core/donut.ts index 9745e0f2..a9c21fb5 100644 --- a/core/donut.ts +++ b/core/donut.ts @@ -628,7 +628,7 @@ export class App { return Donut_GetRendererString(this.handle); } - // The app's nvrhi::IDevice, for code that works with NVRHI directly (e.g. core/paged_images.cpp). + // The app's nvrhi::IDevice, for code that works with NVRHI directly (e.g. examples/memory_management/paged_images.cpp). getNvrhiDevice(): Opaque { return Donut_GetNvrhiDevice(this.handle); } @@ -3063,7 +3063,7 @@ export class RtPipelineDesc { Donut_RtPipelineSetAllowOpacityMicromaps(this.handle, allow); } - // Whether the pipeline's rays may hit cluster BLASes (core/clas.cpp; D3D12's preview, off by default). + // Whether the pipeline's rays may hit cluster BLASes (examples/clustered_geometry/clas.cpp; D3D12's preview, off by default). setAllowClusteredGeometry(allow: boolean): void { Donut_RtPipelineSetAllowClusteredGeometry(this.handle, allow); } diff --git a/core/donut_interop.cpp b/core/donut_interop.cpp index c1d1a507..96bf030f 100644 --- a/core/donut_interop.cpp +++ b/core/donut_interop.cpp @@ -2745,7 +2745,7 @@ bool UseD3D12RuntimeUnderJit(const char* folder, unsigned version) namespace donut_interop { - // Set by Streamline_Init (core/streamline.cpp, linked only where Streamline is): what AppOptions.Streamline + // Set by Streamline_Init (examples/streamline_demo/streamline.cpp, linked only where Streamline is): what AppOptions.Streamline // does to the device's parameters, to have Streamline's interposer make the device. Empty otherwise. std::function g_StreamlineConfigureDevice; // Also Streamline_Init's: what AppOptions.Streamline does to the new app's device manager (its frame @@ -2884,7 +2884,7 @@ extern "C" // EnableCoreFeatures). if ((options & AppOption_RayTracing) != 0) params.optionalVulkanDeviceExtensions.push_back(VK_NV_PARTITIONED_ACCELERATION_STRUCTURE_EXTENSION_NAME); - // Clustered geometry (core/clas.cpp; Donut chains its feature). + // Clustered geometry (examples/clustered_geometry/clas.cpp; Donut chains its feature). if ((options & AppOption_RayTracing) != 0) params.optionalVulkanDeviceExtensions.push_back(VK_NV_CLUSTER_ACCELERATION_STRUCTURE_EXTENSION_NAME); // Advanced blend operations (Donut_GetAdvancedBlendOperations). @@ -3740,7 +3740,7 @@ extern "C" return app->deviceManager->GetRendererString(); } - // The app's nvrhi::IDevice, for code that works with NVRHI directly (e.g. core/paged_images.cpp). + // The app's nvrhi::IDevice, for code that works with NVRHI directly (e.g. examples/memory_management/paged_images.cpp). DONUT_API void* Donut_GetNvrhiDevice(App* app) { return app->device(); diff --git a/core/donut_interop.d.ts b/core/donut_interop.d.ts index 1a05d7e5..3999bc2b 100644 --- a/core/donut_interop.d.ts +++ b/core/donut_interop.d.ts @@ -38,7 +38,7 @@ // This file only gathers the declarations, grouped by what they do, in core/interop/: the app and // window, the device's support, resources, pipelines, bindings, commands, ray tracing, D3D12-only // features, assets, Donut's scene and render passes, DLSS, ImGui and math, implemented in -// core/donut_interop.cpp (math also in core/msvc_fast_math.cpp); then one file per optional C++ +// core/donut_interop.cpp (math also in examples/raytracing_mini_engine/msvc_fast_math.cpp); then one file per optional C++ // module (core/.cpp, linked only into the examples that use it), with the handles of its // objects. A part references the parts whose enums and types it uses (tslang, unlike tsc, needs a // type declared before it's used), and the order here follows that. tools/check_interop_types.py diff --git a/core/interop/app.d.ts b/core/interop/app.d.ts index caec4d7a..3c69b570 100644 --- a/core/interop/app.d.ts +++ b/core/interop/app.d.ts @@ -148,7 +148,7 @@ enum AppOptions { // With D3D12, shaders index ResourceDescriptorHeap[] (the root signatures of pipelines with a mutable // bindless layout get CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED). HeapDirectlyIndexed = 2048, - // The device made through Streamline (after Streamline_Init, core/streamline.cpp; nothing without it): + // The device made through Streamline (after Streamline_Init, examples/streamline_demo/streamline.cpp; nothing without it): // D3D12's by its interposer, Vulkan's with the interposer as the Vulkan loader. Streamline = 4096 } diff --git a/core/interop/clas.d.ts b/core/interop/clas.d.ts index 3ae104d0..ea8e95b1 100644 --- a/core/interop/clas.d.ts +++ b/core/interop/clas.d.ts @@ -1,10 +1,10 @@ /// -// Cluster acceleration structures (core/clas.cpp) +// Cluster acceleration structures (examples/clustered_geometry/clas.cpp) // Handles of the module's objects (see donut_handles.d.ts). @cpp declare class ClasHandle extends ObjectHandle { private readonly __clas: index; } -// Clustered geometry (core/clas.cpp, linked only into the examples that list it): cluster level +// Clustered geometry (examples/clustered_geometry/clas.cpp, linked only into the examples that list it): cluster level // acceleration structures (CLASes) built from clusters of triangles, cluster templates instantiated from // new vertex positions, cluster BLASes built from CLASes - batches of operations reading their arguments // from buffers (D3D12's preview: Donut_EnableD3D12RaytracingPreview before the app; Vulkan's @@ -20,7 +20,7 @@ @nodrops declare function Donut_ReleaseClasBuffer(clas: ClasHandle, buffer: BufferHandle): void; // Stores the GPU address of byte `offset` of `buffer` at dst[0] (low 32 bits) and dst[1] (high). @nodrops declare function Donut_GetClasBufferAddress(clas: ClasHandle, buffer: BufferHandle, offset: number, dst: Ref): void; -// An operation is described by 17 ints (core/clas.cpp's ClasParam, D3D12's enumeration values): type (0 +// An operation is described by 17 ints (examples/clustered_geometry/clas.cpp's ClasParam, D3D12's enumeration values): type (0 // move, 1 cluster BLASes from CLASes, 2 CLASes from triangles, 3 templates from triangles, 4 CLASes // instantiated from templates), mode (0 implicit destinations, 1 explicit, 2 sizes only), flags (4 fast // trace, 8 fast operation, 0x100 allow data access; moves: 0x200 no overlap), max argument count, the diff --git a/core/interop/denoised_rtao.d.ts b/core/interop/denoised_rtao.d.ts index adc1c7b5..a41ace81 100644 --- a/core/interop/denoised_rtao.d.ts +++ b/core/interop/denoised_rtao.d.ts @@ -1,5 +1,5 @@ /// -// PBRT scenes and RTAO sample sets (core/denoised_rtao.cpp; the denoised_rtao example links it) +// PBRT scenes and RTAO sample sets (examples/denoised_rtao/denoised_rtao.cpp; the denoised_rtao example links it) // Handles of the module's objects (see donut_handles.d.ts). @cpp declare class PbrtSceneHandle { private readonly __pbrtScene: index; } diff --git a/core/interop/device.d.ts b/core/interop/device.d.ts index e4852e3f..49d157da 100644 --- a/core/interop/device.d.ts +++ b/core/interop/device.d.ts @@ -198,7 +198,7 @@ enum ComputeDerivatives { // D3D12's conservative rasterization tier (0 for none); 0 on other graphics APIs. @nodrops declare function Donut_GetD3D12ConservativeRasterizationTier(app: AppHandle): int; @nodrops declare function Donut_GetRendererString(app: AppHandle): string; -// The app's nvrhi::IDevice, for code that works with NVRHI directly (e.g. core/paged_images.cpp). +// The app's nvrhi::IDevice, for code that works with NVRHI directly (e.g. examples/memory_management/paged_images.cpp). @nodrops declare function Donut_GetNvrhiDevice(app: AppHandle): Opaque; // 1 if core/nvrhi.ts can call NVRHI's interfaces in this build: their vtables, member function // convention and std::string are MSVC x64's (core/nvrhi_abi.win32.ts) or those of Android's clang diff --git a/core/interop/fast_block_compress.d.ts b/core/interop/fast_block_compress.d.ts index fe0727eb..4933d2c8 100644 --- a/core/interop/fast_block_compress.d.ts +++ b/core/interop/fast_block_compress.d.ts @@ -1,12 +1,12 @@ /// /// -// FBC block compression of DDS images (core/fast_block_compress.cpp) +// FBC block compression of DDS images (examples/fast_block_compress/fast_block_compress.cpp) // Handles of the module's objects (see donut_handles.d.ts). @cpp declare class FbcTextureHandle { private readonly __fbcTexture: index; } -// The Xbox ATG FastBlockCompress sample's CPU side (core/fast_block_compress.cpp with the sample's -// CPU compressor, core/fbc_cpu.cpp, linked only into the examples that list them). A DDS file in +// The Xbox ATG FastBlockCompress sample's CPU side (examples/fast_block_compress/fast_block_compress.cpp with the sample's +// CPU compressor, examples/fast_block_compress/fbc_cpu.cpp, linked only into the examples that list them). A DDS file in // memory (square, a power of two, 32-bit BGRA / BGRX / RGBA) decoded to RGBA8 levels in the // sample's CPU compressor layout (16-byte aligned, natural pitches, 2x2 and 1x1 replicated to 4x4; // X8 alpha read as 255). Null on failure; free it with Donut_DestroyFbcTexture. diff --git a/core/interop/math.d.ts b/core/interop/math.d.ts index ea527074..1671afe3 100644 --- a/core/interop/math.d.ts +++ b/core/interop/math.d.ts @@ -15,11 +15,11 @@ // The C runtime's log2f and exp2f of (float)x (MiniEngine's ExpVar settings go through both). @nodrops declare function Donut_Log2f(x: number): number; @nodrops declare function Donut_Exp2f(x: number): number; -// MSVC's /fp:fast sinf and cosf of (float)x into dst[0] and dst[1] (core/msvc_fast_math.cpp, linked only +// MSVC's /fp:fast sinf and cosf of (float)x into dst[0] and dst[1] (examples/raytracing_mini_engine/msvc_fast_math.cpp, linked only // into the examples that list it): its cosine can differ from cosf's in the last bits. @nodrops declare function Donut_FastSinCosf(x: number, dst: Ref): void; // The CPU's approximate reciprocal of (float)x (SSE's rcpss; 1 / x without SSE): MSVC's /fp:fast divides -// by it and a Newton-Raphson step (core/msvc_fast_math.cpp). +// by it and a Newton-Raphson step (examples/raytracing_mini_engine/msvc_fast_math.cpp). @nodrops declare function Donut_ApproxRcpf(x: number): number; // The engine's next number from std::uniform_real_distribution(a, b). @nodrops declare function Donut_RandomUniformFloat(randomEngine: RandomEngineHandle, a: number, b: number): number; diff --git a/core/interop/obj_model.d.ts b/core/interop/obj_model.d.ts index 7594ca80..e3095f0b 100644 --- a/core/interop/obj_model.d.ts +++ b/core/interop/obj_model.d.ts @@ -1,10 +1,10 @@ /// -// OBJ models (core/obj_model.cpp) +// OBJ models (examples/sakura_forest_ser/obj_model.cpp) // Handles of the module's objects (see donut_handles.d.ts). @cpp declare class ObjModelHandle { private readonly __objModel: index; } -// Wavefront OBJ models (core/obj_model.cpp, linked only into the examples that list it): +// Wavefront OBJ models (examples/sakura_forest_ser/obj_model.cpp, linked only into the examples that list it): // DirectX-Graphics-Samples' D3D12RaytracingSakuraForestSER loader (ObjModelLoader), objects by their // `o` names, then an object's triangles as three vertices each. Free it with Donut_DestroyObjModel. @nodrops declare function Donut_CreateObjModel(): ObjModelHandle; diff --git a/core/interop/omm_bake.d.ts b/core/interop/omm_bake.d.ts index 6ef70dc7..1ef26cea 100644 --- a/core/interop/omm_bake.d.ts +++ b/core/interop/omm_bake.d.ts @@ -1,11 +1,11 @@ /// /// -// Opacity micromap baking with the OMM SDK (core/omm_bake.cpp) +// Opacity micromap baking with the OMM SDK (examples/opacity_micromaps/omm_bake.cpp) // Handles of the module's objects (see donut_handles.d.ts). @cpp declare class OmmBakerHandle extends ObjectHandle { private readonly __ommBaker: index; } -// Opacity micromaps baked at run time (core/omm_bake.cpp, linked only into the examples that list it): +// Opacity micromaps baked at run time (examples/opacity_micromaps/omm_bake.cpp, linked only into the examples that list it): // the GPU baker of NVIDIA's Opacity Micro-Map SDK (fetched at configure time, WITH_OMM_SDK, Windows) // on the app's device (Donut_GetNvrhiDevice; D3D12 or Vulkan). Null without the SDK or on failure. // Free it with Donut_DestroyOmmBaker before the app: it holds its bakes' buffers. diff --git a/core/interop/paged_images.d.ts b/core/interop/paged_images.d.ts index 3b1a8deb..5ffbe196 100644 --- a/core/interop/paged_images.d.ts +++ b/core/interop/paged_images.d.ts @@ -1,11 +1,11 @@ /// -// Images streamed into video memory a mip level at a time (core/paged_images.cpp) +// Images streamed into video memory a mip level at a time (examples/memory_management/paged_images.cpp) // Handles of the module's objects (see donut_handles.d.ts). @cpp declare class PagedImageSetHandle extends ObjectHandle { private readonly __pagedImageSet: index; } // Images streamed into video memory a mip level at a time under the memory budget -// (core/paged_images.cpp, linked only into the examples that list it; D3D12): +// (examples/memory_management/paged_images.cpp, linked only into the examples that list it; D3D12): // DirectX-Graphics-Samples' D3D12MemoryManagement's paging: reserved textures, each level backed by // heaps of its own, mapped and filled on a copy queue by a paging thread, made resident again or // evicted by the images' priorities under the DXGI budget. Free it with Donut_DestroyPagedImageSet diff --git a/core/interop/raytracing.d.ts b/core/interop/raytracing.d.ts index eef99e49..de2c2fdf 100644 --- a/core/interop/raytracing.d.ts +++ b/core/interop/raytracing.d.ts @@ -143,7 +143,7 @@ enum AccelStructBuildFlags { @nodrops declare function Donut_RtPipelineSetHlslExtensionsUAV(pipelineDesc: RtPipelineDescHandle, slot: int): void; // Whether the pipeline's rays see the opacity micromaps of the BLASes they trace (off by default). @nodrops declare function Donut_RtPipelineSetAllowOpacityMicromaps(pipelineDesc: RtPipelineDescHandle, allow: boolean): void; -// Whether the pipeline's rays may hit cluster BLASes (core/clas.cpp; D3D12's preview, off by default). +// Whether the pipeline's rays may hit cluster BLASes (examples/clustered_geometry/clas.cpp; D3D12's preview, off by default). @nodrops declare function Donut_RtPipelineSetAllowClusteredGeometry(pipelineDesc: RtPipelineDescHandle, allow: boolean): void; @nodrops declare function Donut_CreateRayTracingPipelineFromDesc(app: AppHandle, pipelineDesc: RtPipelineDescHandle): RtPipelineHandle; // Shader tables of any shape, filled with the Donut_ShaderTable* functions; they keep the diff --git a/core/interop/rtxdi.d.ts b/core/interop/rtxdi.d.ts index 846f4b30..4ac7da09 100644 --- a/core/interop/rtxdi.d.ts +++ b/core/interop/rtxdi.d.ts @@ -1,5 +1,5 @@ /// -// RTXDI (core/rtxdi.cpp; the RTXDI examples link it): what doesn't depend on a sample's shaders. The Minimal +// RTXDI (examples/rtxdi_minimal/rtxdi.cpp; the RTXDI examples link it): what doesn't depend on a sample's shaders. The Minimal // Sample's resources, light preparation and constants are core/interop/rtxdi_minimal.d.ts'. // Handles of the module's objects (see donut_handles.d.ts). diff --git a/core/interop/rtxdi_minimal.d.ts b/core/interop/rtxdi_minimal.d.ts index ab0f5e82..2b38eebd 100644 --- a/core/interop/rtxdi_minimal.d.ts +++ b/core/interop/rtxdi_minimal.d.ts @@ -1,6 +1,6 @@ /// -// The RTXDI Minimal Sample's resources, light preparation and constants (core/rtxdi_minimal.cpp, over the -// sample's ShaderParameters.h; the rtxdi_minimal example links it with core/rtxdi.cpp). +// The RTXDI Minimal Sample's resources, light preparation and constants (examples/rtxdi_minimal/rtxdi_minimal.cpp, over the +// sample's ShaderParameters.h; the rtxdi_minimal example links it with examples/rtxdi_minimal/rtxdi.cpp). // Handles of the module's objects (see donut_handles.d.ts). @cpp declare class RtxdiResourcesHandle { private readonly __rtxdiResources: index; } diff --git a/core/interop/rtxmg.d.ts b/core/interop/rtxmg.d.ts index 2427bb9f..7977a140 100644 --- a/core/interop/rtxmg.d.ts +++ b/core/interop/rtxmg.d.ts @@ -1,5 +1,5 @@ /// -// RTX Mega Geometry (core/rtxmg.cpp; the rtxmg_demo example links it) +// RTX Mega Geometry (examples/rtxmg_demo/rtxmg.cpp; the rtxmg_demo example links it) // Handles of the module's objects (see donut_handles.d.ts). @cpp declare class RtxmgDemoHandle { private readonly __rtxmgDemo: index; } diff --git a/core/interop/rtxpt.d.ts b/core/interop/rtxpt.d.ts index d709861a..10c5b314 100644 --- a/core/interop/rtxpt.d.ts +++ b/core/interop/rtxpt.d.ts @@ -1,5 +1,5 @@ /// -// RTX Path Tracing (core/rtxpt.cpp; the rtxpt example links it) +// RTX Path Tracing (examples/rtxpt/rtxpt.cpp; the rtxpt example links it) // Handles of the module's objects (see donut_handles.d.ts). @cpp declare class RtxptRendererHandle { private readonly __rtxptRenderer: index; } diff --git a/core/interop/streamline.d.ts b/core/interop/streamline.d.ts index baa3d1c4..7f8c8abc 100644 --- a/core/interop/streamline.d.ts +++ b/core/interop/streamline.d.ts @@ -1,6 +1,6 @@ /// /// -// NVIDIA Streamline (core/streamline.cpp; the streamline_demo example links it, with WITH_STREAMLINE) +// NVIDIA Streamline (examples/streamline_demo/streamline.cpp; the streamline_demo example links it, with WITH_STREAMLINE) // Streamline's features (sl::kFeature* in sl_core_types.h; Latewarp isn't in the 2.12.0 release, not loaded: // the demo reports its status only). diff --git a/core/interop/video_player.d.ts b/core/interop/video_player.d.ts index 1fe83396..94496991 100644 --- a/core/interop/video_player.d.ts +++ b/core/interop/video_player.d.ts @@ -1,10 +1,10 @@ /// -// Video decoding into textures (core/video_player.cpp) +// Video decoding into textures (examples/video_texture/video_player.cpp) // Handles of the module's objects (see donut_handles.d.ts). @cpp declare class VideoPlayerHandle { private readonly __videoPlayer: index; } -// The Xbox ATG VideoTexturePC12 sample's MediaEnginePlayer (core/video_player.cpp, linked only into +// The Xbox ATG VideoTexturePC12 sample's MediaEnginePlayer (examples/video_texture/video_player.cpp, linked only into // the examples that list it; Windows): Media Foundation's Media Engine playing a video file (path // relative to the executable's directory) on a D3D11 device of the adapter with this LUID // (Donut_GetAdapterLuid; 0, 0: any), muted or not, playing as soon as it can. Null (after printing diff --git a/core/interop/web_audio.d.ts b/core/interop/web_audio.d.ts index 17a527f5..d353d578 100644 --- a/core/interop/web_audio.d.ts +++ b/core/interop/web_audio.d.ts @@ -1,5 +1,5 @@ /// -// Web Audio, the part the Golden Line's soundtrack uses (core/web_audio.cpp; the golden_line example +// Web Audio, the part the Golden Line's soundtrack uses (examples/golden_line/web_audio.cpp; the golden_line example // links it). Nodes, buffers and the destination (node 0) are numbered; a node's parameters too, in // the order of its kind's (GainNode: gain; BiquadFilterNode: frequency, Q, detune; StereoPannerNode: // pan; DelayNode: delayTime; DynamicsCompressorNode: threshold, knee, ratio, attack, release; diff --git a/core/rtxpt_game.ts b/core/rtxpt_game.ts index b7eba10c..74eaf849 100644 --- a/core/rtxpt_game.ts +++ b/core/rtxpt_game.ts @@ -918,7 +918,7 @@ export class RtxptGame { this.playSpeed = 3; } - // GameScene::SceneLoaded: after the scene file loaded (rtxpt: core/rtxpt.cpp's LoadScene, before the rest of the + // GameScene::SceneLoaded: after the scene file loaded (rtxpt: examples/rtxpt/rtxpt.cpp's LoadScene, before the rest of the // loading, FinishLoadingScene), in `world`. The game's files are in /SampleGame/. sceneLoaded(world: GameWorld, scenePath: string, assetsPath: string, propShowTags: string, propCameraAttach: string) { this.deinitialize(); diff --git a/docs/clustered_geometry_vulkan_gpu_faults.md b/docs/clustered_geometry_vulkan_gpu_faults.md index 96d2a62c..a6971173 100644 --- a/docs/clustered_geometry_vulkan_gpu_faults.md +++ b/docs/clustered_geometry_vulkan_gpu_faults.md @@ -11,14 +11,14 @@ This document records what happened, how the cause was found, and how to work on | | | |---|---| -| Code | merged in #280 (`core/clas.cpp`, the argument-filling shaders, `shaders/clustered_geometry_spirv.cfg`) | +| Code | merged in #280 (`examples/clustered_geometry/clas.cpp`, the argument-filling shaders, `shaders/clustered_geometry_spirv.cfg`) | | Machine | NVIDIA GeForce RTX 5080, driver 621.14, Windows 11, Vulkan SDK 1.4.321.1 | | Before the fix | plain and traditional runs passed; the mode-switch run, `-vk -test -at 1:geom-traditional -at 2:geom-clusters -at 2:extra-1k -at 3:alloc-getsizes`, faulted the GPU | | After the fix | with `-debug`, the plain run, each switch alone (`geom-traditional`, `extra-1k`, `alloc-getsizes`) and the full mode-switch run pass, with the validation layer clean and no driver events; all 7 `clustered_geometry` CTests (4 D3D12, 3 Vulkan) pass | ## What the Vulkan path does -- `core/clas.cpp` calls `vkGetClusterAccelerationStructureBuildSizesNV` and `vkCmdBuildClusterAccelerationStructureIndirectNV` +- `examples/clustered_geometry/clas.cpp` calls `vkGetClusterAccelerationStructureBuildSizesNV` and `vkCmdBuildClusterAccelerationStructureIndirectNV` through `vkGetDeviceProcAddr`, as `core/ptlas.cpp` does for partitioned TLASes. It translates the D3D12 operation description (types, modes, flags, limits) into `VkClusterAccelerationStructureInputInfoNV`. - Allow data access `0x100` becomes `VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_DATA_ACCESS_BIT_KHR`. diff --git a/docs/mimalloc.md b/docs/mimalloc.md index d8807d9f..24f608ab 100644 --- a/docs/mimalloc.md +++ b/docs/mimalloc.md @@ -134,7 +134,7 @@ Fine as they are: buffers). Checked on 2026-11-08: the only `malloc`/`free` calls in `core/` are `FbcAlignedMalloc` / -`FbcAlignedFree` (`core/fbc_cpu_compat.h`) and the BMP buffer in `core/pbrt/PBRTParser.cpp`, both +`FbcAlignedFree` (`examples/fast_block_compress/fbc_cpu_compat.h`) and the BMP buffer in `examples/denoised_rtao/pbrt/PBRTParser.cpp`, both allocated and freed on the C++ side; `cgltf_free` in `core/donut_interop.cpp` releases cgltf's own data. Everything else crosses as handles with a destroy function. `nri_interop` has not been checked. A quick search to repeat: diff --git a/docs/nri_migration_order.md b/docs/nri_migration_order.md index 45d76da9..265c18a8 100644 --- a/docs/nri_migration_order.md +++ b/docs/nri_migration_order.md @@ -572,7 +572,7 @@ These need something NRI does not provide: - **nvrhi_direct**, **headless**: these examples are about NVRHI itself. - **memory_management**: reserved textures whose mip levels are backed by heaps of their own, made resident and evicted by priority under the DXGI budget (D3D12's MakeResident / Evict, through - `core/paged_images.cpp`): NRI has neither sparse resources (as for **reserved_resources**) nor + `examples/memory_management/paged_images.cpp`): NRI has neither sparse resources (as for **reserved_resources**) nor residency control. - **raytracing_library_subobjects**: it's about the state object's subobjects (root signatures, their associations, hit groups, shader and pipeline configs) defined in the DXIL library itself, and its diff --git a/docs/superpowers/plans/2026-11-07-rtxmg-cluster-tess.md b/docs/superpowers/plans/2026-11-07-rtxmg-cluster-tess.md index 6b1456c0..6c836fc1 100644 --- a/docs/superpowers/plans/2026-11-07-rtxmg-cluster-tess.md +++ b/docs/superpowers/plans/2026-11-07-rtxmg-cluster-tess.md @@ -5,7 +5,7 @@ **Goal:** A port of RTX Mega Geometry v2.2.0's `rtxmg_demo` (github.com/NVIDIA-RTX/RTXMG), stage 1: the cluster-tessellation path (Catmull-Clark subdivision surfaces, tessellated into clusters and rebuilt as CLAS/BLAS every frame), path traced with accumulation, matching the reference exe's `--shot-list` frames of `subdivision/amy_kitchenset.scene.json` on Vulkan. **Architecture (RTXCR-style split, chosen 2026-11-07):** -- **Native glue `core/rtxmg.cpp`** (in `donut_interop_shared` when `RTXMG_DIR` is set) owns the RTXMG library objects: `RTXMGScene` (load, pose animation, refresh), `ClusterTessellator` + `ClusterTessAccels`, the HiZ `ZBuffer` and its prepass, and the TLAS (instance descs + `fill_instance_descs`). It hands the TypeScript side the TLAS, buffers and descriptor table it binds. +- **Native glue `examples/rtxmg_demo/rtxmg.cpp`** (in `donut_interop_shared` when `RTXMG_DIR` is set) owns the RTXMG library objects: `RTXMGScene` (load, pose animation, refresh), `ClusterTessellator` + `ClusterTessAccels`, the HiZ `ZBuffer` and its prepass, and the TLAS (instance descs + `fill_instance_descs`). It hands the TypeScript side the TLAS, buffers and descriptor table it binds. - **TypeScript `examples/rtxmg_demo/rtxmg_demo.ts`** owns the app: args and scene settings, camera, the path tracer pipeline and shader table, its binding sets, accumulation, envmap importance-sampling tables, the blit (expose, ACES, sRGB), `-test`. - **Library build:** our CMake adds `${RTXMG_DIR}/rtxmg` and `${RTXMG_DIR}/extern/osd_lite` as subdirectories against our Donut (same commit since PR #290), fetching what RTXMG's root CMake fetches (meshoptimizer v1.1, mimalloc v2.1.7, implot v0.17) and defining the variables its sub-CMake files read (`DONUT_DIR`, `RTXMG_SHADERS_*`, `RTXMG_SHADERMAKE_OPTIONS*`). `rtxmg/CMakeLists.txt` links `envmap` (a `demo/envmap` target): add `${RTXMG_DIR}/demo/envmap` as well. - **Demo shaders** (`rtxmg_demo_path_tracer.hlsl` with `VERTEX_NORMALS=0 CLUSTER_LOD_SHADING=0`, `blit.hlsl`, `lerp_keyframes.hlsl`, `zrender.hlsl`) compile in place via our own `shaders/rtxmg_demo.cfg` with `--sourceDir ${RTXMG_DIR}/demo`, RTXMG's options (`--hlsl2021`, SM 6_6, SPIR-V `--vulkanMemoryLayout scalar -Vd`). @@ -16,7 +16,7 @@ ## Global Constraints -- **License:** RTXMG (code, shaders, assets) is under the NVIDIA RTX SDKs License: nothing from `RTXMG_DIR` is copied into the repo. Headers and shaders are used in place; `core/rtxmg.cpp` carries the 2(b) notice ("This software contains source code provided by NVIDIA Corporation."). Ask before pushing the branch or opening a PR. +- **License:** RTXMG (code, shaders, assets) is under the NVIDIA RTX SDKs License: nothing from `RTXMG_DIR` is copied into the repo. Headers and shaders are used in place; `examples/rtxmg_demo/rtxmg.cpp` carries the 2(b) notice ("This software contains source code provided by NVIDIA Corporation."). Ask before pushing the branch or opening a PR. - **Build gating:** without `RTXMG_DIR`, nothing changes: no library, no example, no tests. - **APIs:** stage 1 is Vulkan only. Our NVRHI has neither NVAPI nor `NVRHI_D3D12_WITH_DXRCLUSTER`, so D3D12 has no cluster operations: `-dx12` prints why and exits 77 (TEST_SKIPPED). D3D12 is a later decision (NVAPI under `RTXMG_DIR`, or native DXR clusters). - **Stage 1 scope:** cluster tessellation only. The library still compiles cluster-LOD (its `scene` links it), but the app never initializes it (`scene->HasClusterLod()` false); bind dummies at t12-t15. No DLSS/denoiser, motion vectors, audio, korgi, maya logger, inspector, profiler UI, timeline. Animation paused at the scene's first frame (the reference's default), but `lerp_keyframes` still runs once: the kitchen set's pose buffers are filled only by it. @@ -36,7 +36,7 @@ - [ ] Check `ENABLE_SHADER_DEBUG` agrees between C++ (glue) and shaders (u12). ### Task 3: Native glue, scene + accels -- [ ] `core/rtxmg.cpp`: `Rtxmg_Create(device, shaderFactory, commonPasses, descriptorTable, textureCache)` with the bindless layout (`MakeGlobalBindlessLayoutDesc`, capacity reserved before any descriptor), `Rtxmg_LoadScene(path)` (synchronous `LoadWithThreadPool`, `FinishedLoading`), scene settings accessors (camera view, envmap path/rotation, spp, bounces, exposure...), `Rtxmg_UpdateAccels(camera, cl)` (poses, `ResizeAccelStorage`, HiZ prepass, `BuildAccel` while `tessRateAdjusted`, `Refresh`, TLAS), getters for TLAS / instance / material / shading-data / cluster vertex buffers. +- [ ] `examples/rtxmg_demo/rtxmg.cpp`: `Rtxmg_Create(device, shaderFactory, commonPasses, descriptorTable, textureCache)` with the bindless layout (`MakeGlobalBindlessLayoutDesc`, capacity reserved before any descriptor), `Rtxmg_LoadScene(path)` (synchronous `LoadWithThreadPool`, `FinishedLoading`), scene settings accessors (camera view, envmap path/rotation, spp, bounces, exposure...), `Rtxmg_UpdateAccels(camera, cl)` (poses, `ResizeAccelStorage`, HiZ prepass, `BuildAccel` while `tessRateAdjusted`, `Refresh`, TLAS), getters for TLAS / instance / material / shading-data / cluster vertex buffers. - [ ] Wrappers via `generate_donut_wrappers.py` conventions; donut.ts regenerated, never hand-edited. ### Task 4: TypeScript example, first frame diff --git a/docs/superpowers/plans/2026-11-08-rtxdi-minimal.md b/docs/superpowers/plans/2026-11-08-rtxdi-minimal.md index fc1f34ec..7f08b8f2 100644 --- a/docs/superpowers/plans/2026-11-08-rtxdi-minimal.md +++ b/docs/superpowers/plans/2026-11-08-rtxdi-minimal.md @@ -4,7 +4,7 @@ **Goal:** A tslang example, `rtxdi_minimal`, that ports RTXDI 3.0.0's Minimal Sample (fused single-pass ReSTIR DI on the Arcade) on D3D12 and Vulkan and matches the reference build frame by frame. -**Architecture:** RTXDI (NVIDIA RTX SDKs License) is used in place from a checkout via `RTXDI_DIR`, the `rtxpt` way: its host library compiles as static `rtxdi_runtime`, the Minimal Sample's two HLSL files compile by ShaderMake from `RTXDI_DIR/Samples/MinimalSample/Shaders`. Native glue `core/rtxdi.cpp` owns everything touching RTXDI C++ types or `ShaderParameters.h` layouts (context, resources, light preparation, constant buffers) behind a flat C API typed in `core/interop/rtxdi.d.ts`. TypeScript holds the app: reusable `examples/rtxdi_minimal/rtxdi_di.ts` (context/resources/light-prep wrappers, render targets) and the minimal frame in `examples/rtxdi_minimal/rtxdi_minimal.ts`. +**Architecture:** RTXDI (NVIDIA RTX SDKs License) is used in place from a checkout via `RTXDI_DIR`, the `rtxpt` way: its host library compiles as static `rtxdi_runtime`, the Minimal Sample's two HLSL files compile by ShaderMake from `RTXDI_DIR/Samples/MinimalSample/Shaders`. Native glue `examples/rtxdi_minimal/rtxdi.cpp` owns everything touching RTXDI C++ types or `ShaderParameters.h` layouts (context, resources, light preparation, constant buffers) behind a flat C API typed in `core/interop/rtxdi.d.ts`. TypeScript holds the app: reusable `examples/rtxdi_minimal/rtxdi_di.ts` (context/resources/light-prep wrappers, render targets) and the minimal frame in `examples/rtxdi_minimal/rtxdi_minimal.ts`. **Tech Stack:** tslang, Donut/NVRHI (D3D12, Vulkan, inline ray queries), RTXDI SDK 3.0.0, CMake/CTest, HLSL via ShaderMake (DXC). @@ -14,7 +14,7 @@ - Reference checkout `E:\Gits\RTXDI`, RTXDI SDK v3.0.0 (commit `1b55517`, library `Libraries/Rtxdi` at `d28e20f`). Reference exe `E:\Gits\RTXDI\build\bin\MinimalSample.exe`. - Nothing from `RTXDI_DIR` committed: no code, no shaders, no assets, no reference images. The reference dump patch stays uncommitted in the RTXDI working tree, saved as a file in the session-notes folder. -- `core/rtxdi.cpp` carries the notice "This software contains source code provided by NVIDIA Corporation." (as `core/rtxpt.cpp`). +- `examples/rtxdi_minimal/rtxdi.cpp` carries the notice "This software contains source code provided by NVIDIA Corporation." (as `examples/rtxpt/rtxpt.cpp`). - `RTXDI_DIR` and `RTXPT_DIR` together: configure fails with `message(FATAL_ERROR ...)` explaining why (old RTXDI headers in `rtxpt_core`'s PUBLIC includes). - Shader compile options as the reference: `--shaderModel 6_5 --vulkanVersion 1.2 --relaxedInclude "../Types.h" -D SPIRV` (SPIR-V) and `NVRHI_DEFAULT_VK_REGISTER_OFFSETS`. - Frame parameters as the sample: camera `LookAt((-1.658, 1.577, 1.69), (-0.9645, 1.2672, 1.0396))`, move speed 3, vertical FOV 60°, `perspProjD3DStyleReverse(60°, aspect, 0.01)`, no jitter, render size = back buffer, HDR output (RGBA16_FLOAT) blitted unmodified. @@ -30,7 +30,7 @@ 2. **Ping-pong swap order** — binding sets, G-buffer current/previous and `viewPrevious` swapped *after* submit, once per frame; an off-by-one only shows with a moving camera. Test: Task 6 Step 4 (moving-camera compare). 3. **Window resize** — context, render targets, RTXDI resources and binding sets recreated (sample nulls them in `BackBufferResized`), no validation errors. Test: Task 5 Step 5 (`-test -resizeAt 10`). 4. **Vulkan validation** — the neighbor-offsets buffer padding must silence the README's known warning; `-debug` runs must log zero validation messages. Test: Task 4 Step 4. -5. **JIT vs AOT** — `core/rtxdi.cpp` + `rtxdi_runtime` linked into `donut_interop_shared`; shaders found from `bin/` under `tslang.exe`. Test: Task 7 Step 2. +5. **JIT vs AOT** — `examples/rtxdi_minimal/rtxdi.cpp` + `rtxdi_runtime` linked into `donut_interop_shared`; shaders found from `bin/` under `tslang.exe`. Test: Task 7 Step 2. --- @@ -42,7 +42,7 @@ - Modify: `CMakePresets.json` (configure/build presets `default-rtxdi`, `release-rtxdi`, binaryDir `build-rtxdi` / `build-release-rtxdi`, `RTXDI_DIR = E:/Gits/RTXDI`, inheriting like `default-rtxpt`) **Interfaces:** -- Produces: CMake `RTXDI_DIR` (PATH, default ""); static target `rtxdi_runtime` (all of `RTXDI_DIR/Libraries/Rtxdi/Source/*.cpp`, PUBLIC include `RTXDI_DIR/Libraries/Rtxdi/Include`); target `rtxdi_minimal_shaders` → `bin/shaders/rtxdi_minimal/{dxil,spirv}/{PrepareLights,Render}_main.*`; CMake var `RTXDI_GLUE_SOURCES = core/rtxdi.cpp` appended to `JIT_MODULE_SOURCES`; a `bin/Assets` junction → `RTXDI_DIR/Assets` (as rtxpt's, guarded by `NOT EXISTS`). +- Produces: CMake `RTXDI_DIR` (PATH, default ""); static target `rtxdi_runtime` (all of `RTXDI_DIR/Libraries/Rtxdi/Source/*.cpp`, PUBLIC include `RTXDI_DIR/Libraries/Rtxdi/Include`); target `rtxdi_minimal_shaders` → `bin/shaders/rtxdi_minimal/{dxil,spirv}/{PrepareLights,Render}_main.*`; CMake var `RTXDI_GLUE_SOURCES = examples/rtxdi_minimal/rtxdi.cpp` appended to `JIT_MODULE_SOURCES`; a `bin/Assets` junction → `RTXDI_DIR/Assets` (as rtxpt's, guarded by `NOT EXISTS`). - [ ] **Step 1:** Add the block: guard `if (RTXDI_DIR AND RTXPT_DIR) message(FATAL_ERROR "...")`; `rtxdi_runtime` (or `add_subdirectory(${RTXDI_DIR}/Libraries/Rtxdi ...)` if it configures cleanly — pick one, comment why); `donut_compile_shaders(TARGET rtxdi_minimal_shaders PROJECT_NAME "RTXDI" CONFIG shaders/rtxdi_minimal.cfg INCLUDES ${RTXDI_DIR}/Libraries/Rtxdi/Include ... SHADER_MODEL 6_5 SHADERMAKE_OPTIONS "--sourceDir ${RTXDI_DIR}/Samples/MinimalSample/Shaders --vulkanVersion 1.2 --relaxedInclude ../Types.h" ...)` (our `compileshaders.cmake` emits `--shaderModel` from `SHADER_MODEL`, default 6_5 — keep it explicit; don't use rtxpt's `-m 6_9`), with the reference's `-D SPIRV` for SPIR-V and VK register offsets (match `E:\Gits\RTXDI\External\donut\compileshaders.cmake`'s handling of `NVRHI_DEFAULT_VK_REGISTER_OFFSETS`). Donut shader includes are ours. License comment like rtxpt's. - [ ] **Step 2:** `shaders/rtxdi_minimal.cfg`: `PrepareLights.hlsl -T cs -E main` and `Render.hlsl -T cs -E main`. @@ -64,8 +64,8 @@ Work in `E:\Gits\RTXDI`. Save the patch as `/rtxdi_minimal_referen ### Task 3: Native glue — context, resources, constants **Files:** -- Create: `core/rtxdi.cpp`, `core/interop/rtxdi.d.ts` -- Modify: `CMakeLists.txt` (`core/rtxdi.cpp` per-source includes: `RTXDI_DIR/Libraries/Rtxdi/Include`, `RTXDI_DIR/Samples/MinimalSample/Shaders` for `ShaderParameters.h`; link `rtxdi_runtime` into `donut_interop_shared` and the example) +- Create: `examples/rtxdi_minimal/rtxdi.cpp`, `core/interop/rtxdi.d.ts` +- Modify: `CMakeLists.txt` (`examples/rtxdi_minimal/rtxdi.cpp` per-source includes: `RTXDI_DIR/Libraries/Rtxdi/Include`, `RTXDI_DIR/Samples/MinimalSample/Shaders` for `ShaderParameters.h`; link `rtxdi_runtime` into `donut_interop_shared` and the example) - Regenerate: `core/donut.ts` **Interfaces (all `@nodrops declare function` in `rtxdi.d.ts`; handle types declared like other interop handles):** @@ -81,7 +81,7 @@ Work in `E:\Gits\RTXDI`. Save the patch as `/rtxdi_minimal_referen - `Rtxdi_SaveTextureRGBA32F(app: AppHandle, texture: TextureHandle, path: string): int` — readback + the Task 2 dump format; nonzero on success. - [ ] **Step 1:** Write `rtxdi.d.ts` with the declarations above and comments in the house style; regenerate `core/donut.ts`; expected: generator succeeds, `git diff --stat core/donut.ts` shows only rtxdi additions. -- [ ] **Step 2:** Implement `core/rtxdi.cpp`. `static_assert` that `sizeof(RAB_LightInfo) == 32` and `sizeof(PrepareLightsTask) == 16` so layout drift fails at compile time. +- [ ] **Step 2:** Implement `examples/rtxdi_minimal/rtxdi.cpp`. `static_assert` that `sizeof(RAB_LightInfo) == 32` and `sizeof(PrepareLightsTask) == 16` so layout drift fails at compile time. - [ ] **Step 3: Build** `cmake --build build-rtxdi --target donut_interop_shared`; expected: links (no duplicate `rtxdi::` symbols). - [ ] **Step 4: Commit** `rtxdi: native glue for ReSTIR DI context, resources and constants`. diff --git a/docs/superpowers/plans/2026-11-08-streamline-demo.md b/docs/superpowers/plans/2026-11-08-streamline-demo.md index bbbb5671..884c0c7b 100644 --- a/docs/superpowers/plans/2026-11-08-streamline-demo.md +++ b/docs/superpowers/plans/2026-11-08-streamline-demo.md @@ -4,7 +4,7 @@ **Goal:** A tslang example, `streamline_demo`, that ports NVIDIA's Streamline Sample 2.12.0 frame on its `sponza-plus` scene and drives Streamline's DLSS-SR, DLSS-RR, DeepDVC, Reflex, DLSS-G (and Latewarp if the public SDK has it) on D3D12 and Vulkan. -**Architecture:** Streamline 2.12.0 (MIT) is fetched at configure time as the signed release zip. The sample itself (NVIDIA RTX SDKs license) is used in place from a checkout, the RTXPT/RTXCR way: `STREAMLINE_SAMPLE_DIR` points at it, its ray-gen and UI-composite HLSL compile from there, nothing is copied. Native glue `core/streamline.cpp` loads `sl.interposer.dll` by full path (works under the JIT), hooks Donut's device creation through a new Donut patch, and exposes a flat C API typed in `core/interop/streamline.d.ts`. `examples/streamline_demo.ts` is the sample's host (`StreamlineSample.cpp`), reusing Donut render passes the way `examples/feature_demo.ts` does. +**Architecture:** Streamline 2.12.0 (MIT) is fetched at configure time as the signed release zip. The sample itself (NVIDIA RTX SDKs license) is used in place from a checkout, the RTXPT/RTXCR way: `STREAMLINE_SAMPLE_DIR` points at it, its ray-gen and UI-composite HLSL compile from there, nothing is copied. Native glue `examples/streamline_demo/streamline.cpp` loads `sl.interposer.dll` by full path (works under the JIT), hooks Donut's device creation through a new Donut patch, and exposes a flat C API typed in `core/interop/streamline.d.ts`. `examples/streamline_demo/streamline_demo.ts` is the sample's host (`StreamlineSample.cpp`), reusing Donut render passes the way `examples/feature_demo.ts` does. **Tech Stack:** tslang, Donut/NVRHI (D3D12, Vulkan), Streamline SDK 2.12.0, CMake/CTest, HLSL via ShaderMake. @@ -70,10 +70,10 @@ Nothing here is committed. Work in `E:\Gits\Streamline_Sample`; keep the dump pa ### Task 3: Native Streamline glue + device hook **Files:** -- Create: `core/streamline.cpp`, `core/interop/streamline.d.ts` +- Create: `examples/streamline_demo/streamline.cpp`, `core/interop/streamline.d.ts` - Create: `patches/Donut-streamline-device-hooks.patch` (appended last to the Donut patch list in `CMakeLists.txt` ~line 170) - Modify: `core/donut_interop.cpp` (`Donut_CreateAppWithOptions`: new option bit), `core/interop/app.d.ts` (`AppOptions.Streamline = 4096`) -- Modify: `CMakeLists.txt` (`core/streamline.cpp` into `JIT_MODULE_SOURCES` and the example when `WITH_STREAMLINE`) +- Modify: `CMakeLists.txt` (`examples/streamline_demo/streamline.cpp` into `JIT_MODULE_SOURCES` and the example when `WITH_STREAMLINE`) - Regenerate: `core/donut.ts` **Interfaces (C API, all `@nodrops declare function` in `streamline.d.ts`):** @@ -81,9 +81,9 @@ Nothing here is committed. Work in `E:\Gits\Streamline_Sample`; keep the dump pa - `Streamline_IsFeatureSupported(app: AppHandle, feature: StreamlineFeature): int` and `Streamline_FeatureStatusText(feature): string` (copied string). - `Streamline_Shutdown(): void` — clears tags, `slShutdown`; must run before `Donut_DestroyApp`. - `enum StreamlineFeature { DLSS = 0, Reflex = 3, PCL = 4, DeepDVC = 5, Latewarp = 6, DLSS_G = 1000, DLSS_RR = 1001 }` (= `sl::kFeature*` in `sl_core_types.h`). -- Donut patch: `DeviceCreationParameters` gains `std::function d3d12CreateDevice` and `std::function createDxgiFactory2`, used by `DeviceManager_DX12` when set; Vulkan uses Donut's existing `vulkanLibraryName` (set to the interposer's full path) and the GLFW loader (`glfwInitVulkanLoader` with the interposer's `vkGetInstanceProcAddr`). `AppOption_Streamline` fills these from `core/streamline.cpp` and adds the four Vulkan extensions above. +- Donut patch: `DeviceCreationParameters` gains `std::function d3d12CreateDevice` and `std::function createDxgiFactory2`, used by `DeviceManager_DX12` when set; Vulkan uses Donut's existing `vulkanLibraryName` (set to the interposer's full path) and the GLFW loader (`glfwInitVulkanLoader` with the interposer's `vkGetInstanceProcAddr`). `AppOption_Streamline` fills these from `examples/streamline_demo/streamline.cpp` and adds the four Vulkan extensions above. -- [ ] **Step 1: Write the failing test** — `examples/streamline_demo.ts` minimal: `Streamline_Init`, create app with `AppOptions.Streamline`, log one line per feature `": supported|"`, `Streamline_Shutdown`, destroy app. Under `-test` with `-slDisable` (skip `Streamline_Init`): every feature reports unsupported, exit `TEST_SKIPPED`. Register `add_tslang_example_test(streamline_demo ARGS -width 1280 -height 720)` and a `_vk` variant. +- [ ] **Step 1: Write the failing test** — `examples/streamline_demo/streamline_demo.ts` minimal: `Streamline_Init`, create app with `AppOptions.Streamline`, log one line per feature `": supported|"`, `Streamline_Shutdown`, destroy app. Under `-test` with `-slDisable` (skip `Streamline_Init`): every feature reports unsupported, exit `TEST_SKIPPED`. Register `add_tslang_example_test(streamline_demo ARGS -width 1280 -height 720)` and a `_vk` variant. - [ ] **Step 2:** Build; run `ctest --preset streamline -R streamline_demo` → FAIL (symbols undefined). - [ ] **Step 3:** Implement the patch, glue and option as above; regenerate `donut.ts`. - [ ] **Step 4:** Run the tests. Expected on RTX GPU: PASS with DLSS, DLSS_RR, DeepDVC, Reflex supported; exit 0 (clean shutdown). Also run with `-debug`: no NVRHI/D3D/VK validation errors. @@ -93,7 +93,7 @@ Nothing here is committed. Work in `E:\Gits\Streamline_Sample`; keep the dump pa ### Task 4: Port the sample's frame (no Streamline features) **Files:** -- Modify: `examples/streamline_demo.ts` (scene, passes, UI, `StreamlineDemoArgs extends Args`) +- Modify: `examples/streamline_demo/streamline_demo.ts` (scene, passes, UI, `StreamlineDemoArgs extends Args`) - Create: `shaders/streamline_demo.cfg` (compiles `${STREAMLINE_SAMPLE_DIR}/src/StreamlineSample.hlsl` `-T lib -D REFLECT_MATERIALS={0,1}` and the UI-composite PS, `--sourceDir ${STREAMLINE_SAMPLE_DIR}/src`) - Modify: `CMakeLists.txt` (`STREAMLINE_SAMPLE_DIR` cache PATH; example built only when it and `WITH_STREAMLINE` are set; `MEDIA fonts sponza-plus.scene.json glTF-Sample-Assets`) @@ -109,7 +109,7 @@ Nothing here is committed. Work in `E:\Gits\Streamline_Sample`; keep the dump pa ### Task 5: DLSS-SR, constants, common tags, Reflex/PCL markers -**Files:** Modify `core/streamline.cpp`, `core/interop/streamline.d.ts`, `examples/streamline_demo.ts`; regenerate `core/donut.ts`. +**Files:** Modify `examples/streamline_demo/streamline.cpp`, `core/interop/streamline.d.ts`, `examples/streamline_demo/streamline_demo.ts`; regenerate `core/donut.ts`. **Interfaces:** - `Streamline_BeginFrame(): int` (frame token + `slReflexSleep` — get the token **always**, not only with Reflex, unlike the sample), `Streamline_PclMarker(marker: int): void`, `Streamline_SetReflex(mode: int, fpsCap: int): void`, `Streamline_ReflexLatencyMs(): number`. @@ -146,7 +146,7 @@ Nothing here is committed. Work in `E:\Gits\Streamline_Sample`; keep the dump pa ### Task 8: DLSS Frame Generation (+ UI tagging, swapchain recreation) -**Files:** `core/streamline.cpp`, `streamline.d.ts`, the Donut patch (D3D12 swapchain re-creation hook in `BeginFrame`), `examples/streamline_demo.ts`. +**Files:** `examples/streamline_demo/streamline.cpp`, `streamline.d.ts`, the Donut patch (D3D12 swapchain re-creation hook in `BeginFrame`), `examples/streamline_demo/streamline_demo.ts`. **Interfaces:** `Streamline_SetDlssG(mode: int, framesToGenerate: int): void` (`eRetainResourcesWhenOff`; off while the mouse is over ImGui), `Streamline_DlssGState(): int` (`status | numFramesActuallyPresented << 8`), `Streamline_TagUi(cmd, uiColorAlpha: TextureHandle, uiAlpha: TextureHandle, backbufferW: int, backbufferH: int): void`; args `-dlssg ` (forces Reflex ≥1, as the sample). diff --git a/docs/superpowers/specs/2026-10-10-typed-interop-handles-design.md b/docs/superpowers/specs/2026-10-10-typed-interop-handles-design.md index d89d005c..3dae70c4 100644 --- a/docs/superpowers/specs/2026-10-10-typed-interop-handles-design.md +++ b/docs/superpowers/specs/2026-10-10-typed-interop-handles-design.md @@ -110,7 +110,7 @@ Rules for `donut_interop.d.ts`: ### 2. C++ side - The `extern "C"` functions in `core/donut_interop.cpp`, `core/sdkmesh.cpp`, - `core/video_player.cpp`, `core/basis_transcoder.cpp`, `core/fast_block_compress.cpp` and + `examples/video_texture/video_player.cpp`, `core/basis_transcoder.cpp`, `examples/fast_block_compress/fast_block_compress.cpp` and `core/directx_collision.cpp` take and return the real pointer types (`App*`, `FrameContext*`, `TsRenderPass*`, `nvrhi::IBuffer*`, `nvrhi::ITexture*`, `nvrhi::rt::IAccelStruct*`, `donut::engine::Scene*`, `TriangleBlas*`, ...) instead of `void*`. diff --git a/docs/superpowers/specs/2026-11-08-rtxdi-minimal-design.md b/docs/superpowers/specs/2026-11-08-rtxdi-minimal-design.md index 10a1e632..26232127 100644 --- a/docs/superpowers/specs/2026-11-08-rtxdi-minimal-design.md +++ b/docs/superpowers/specs/2026-11-08-rtxdi-minimal-design.md @@ -83,7 +83,7 @@ the tag; library submodule `Libraries/Rtxdi` at `d28e20f`). reason in a comment. - `RTXPT_DIR` and `RTXDI_DIR` in one build tree are **unsupported for now** *(Claude's call)*: `rtxpt_core` exports RTXPT's older RTXDI headers as a PUBLIC include into the one JIT DLL - (`donut_interop_shared`), which would leak into `core/rtxdi.cpp`. Configure stops with a clear + (`donut_interop_shared`), which would leak into `examples/rtxdi_minimal/rtxdi.cpp`. Configure stops with a clear error if both are set; the separate `*-rtxdi` presets keep them apart. Revisit (per-source include isolation) when the Full Sample port needs it. - Vulkan: the Render pass uses inline ray queries (`RaytracingAccelerationStructure` + `RayQuery` @@ -95,7 +95,7 @@ the tag; library submodule `Libraries/Rtxdi` at `d28e20f`). `Donut_GetMeshInstanceGeometryCount`, …), scene buffers (`Donut_GetSceneBuffer`), descriptor table manager / bindless layout, scene loading with a descriptor table. - `core/donut.ts` is generated — never hand-edited; new interop goes in a new `.d.ts` in - `core/interop/` (e.g. `rtxdi.d.ts`) plus `core/rtxdi.cpp`, then the generator is rerun. + `core/interop/` (e.g. `rtxdi.d.ts`) plus `examples/rtxdi_minimal/rtxdi.cpp`, then the generator is rerun. ## Decided shape @@ -117,8 +117,8 @@ the tag; library submodule `Libraries/Rtxdi` at `d28e20f`). `RTXDI_DIR/Libraries/Rtxdi/Include` and **our** Donut shader headers (the scene's `InstanceData`/`GeometryData`/`MaterialConstants` layouts must match our Donut's scene buffers — the RTXPT precedent). Output `bin/shaders/rtxdi_minimal/{dxil,spirv}`. -- **Native glue** `core/rtxdi.cpp` (with the license notice "This software contains source code - provided by NVIDIA Corporation." where the supplement asks for it, as `core/rtxpt.cpp` does), and +- **Native glue** `examples/rtxdi_minimal/rtxdi.cpp` (with the license notice "This software contains source code + provided by NVIDIA Corporation." where the supplement asks for it, as `examples/rtxpt/rtxpt.cpp` does), and `core/interop/rtxdi.d.ts`. - **Assets** referenced in place (`RTXDI_DIR/Assets/Media`); the example takes the Arcade path from a build-time define or a link next to the executable, like rtxpt's `Assets` junction. For ctest @@ -133,7 +133,7 @@ The sample's own C++ (~1.7k lines: `main.cpp`, `PrepareLightsPass`, `RenderPass` - **TypeScript** (`examples/rtxdi_minimal/rtxdi_minimal.ts` + reusable `core/rtxdi_*.ts` modules): app/frame loop, camera, view + previous view, UI, Args, render targets (two G-buffer sets ping-ponged), the two passes' pipelines and binding sets, dispatch, blit, test mode. -- **C++ glue** (`core/rtxdi.cpp`), *Claude's call*: everything that touches RTXDI's C++ types or the +- **C++ glue** (`examples/rtxdi_minimal/rtxdi.cpp`), *Claude's call*: everything that touches RTXDI's C++ types or the sample's `ShaderParameters.h` struct layouts: - an opaque `RtxdiDIContext` handle wrapping `rtxdi::ReSTIRDIContext` (create with render size, `SetFrameIndex`, buffer indices, reservoir buffer parameters, neighbor-offset count); diff --git a/core/clas.cpp b/examples/clustered_geometry/clas.cpp similarity index 99% rename from core/clas.cpp rename to examples/clustered_geometry/clas.cpp index 22596b7f..0cba8eb4 100644 --- a/core/clas.cpp +++ b/examples/clustered_geometry/clas.cpp @@ -30,7 +30,7 @@ #include #include -#include "donut_api.h" +#include "../../core/donut_api.h" #define VK_NO_PROTOTYPES #include diff --git a/examples/clustered_geometry/clas.ts b/examples/clustered_geometry/clas.ts index dbc1d329..c415f3e8 100644 --- a/examples/clustered_geometry/clas.ts +++ b/examples/clustered_geometry/clas.ts @@ -1,10 +1,10 @@ // Generated by tools/generate_donut_wrappers.py from donut_interop.d.ts: don't edit, regenerate. // -// The Clas class, as in donut.ts, over the Donut_* functions core/clas.cpp defines, kept out of -// donut.ts (which every example links) for the examples that link core/clas.cpp: import with -// `import { Clas } from "./clas";` (from examples/clustered_geometry/) and list -// examples/clustered_geometry/clas.ts with core/clas.cpp in the example's add_tslang_example -// sources. +// The Clas class, as in donut.ts, over the Donut_* functions examples/clustered_geometry/clas.cpp +// defines, kept out of donut.ts (which every example links) for the examples that link +// examples/clustered_geometry/clas.cpp: import with `import { Clas } from "./clas";` (from +// examples/clustered_geometry/) and list examples/clustered_geometry/clas.ts with +// examples/clustered_geometry/clas.cpp in the example's add_tslang_example sources. /// @@ -21,7 +21,7 @@ export class Clas { return !this.handle; } - // Clustered geometry (core/clas.cpp, linked only into the examples that list it): cluster level + // Clustered geometry (examples/clustered_geometry/clas.cpp, linked only into the examples that list it): cluster level // acceleration structures (CLASes) built from clusters of triangles, cluster templates instantiated from // new vertex positions, cluster BLASes built from CLASes - batches of operations reading their arguments // from buffers (D3D12's preview: Donut_EnableD3D12RaytracingPreview before the app; Vulkan's @@ -55,7 +55,7 @@ export class Clas { Donut_GetClasBufferAddress(this.handle, buffer, offset, dst); } - // An operation is described by 17 ints (core/clas.cpp's ClasParam, D3D12's enumeration values): type (0 + // An operation is described by 17 ints (examples/clustered_geometry/clas.cpp's ClasParam, D3D12's enumeration values): type (0 // move, 1 cluster BLASes from CLASes, 2 CLASes from triangles, 3 templates from triangles, 4 CLASes // instantiated from templates), mode (0 implicit destinations, 1 explicit, 2 sizes only), flags (4 fast // trace, 8 fast operation, 0x100 allow data access; moves: 0x200 no overlap), max argument count, the diff --git a/examples/clustered_geometry/clustered_geometry.ts b/examples/clustered_geometry/clustered_geometry.ts index 855f5b2b..e8fd5ed9 100644 --- a/examples/clustered_geometry/clustered_geometry.ts +++ b/examples/clustered_geometry/clustered_geometry.ts @@ -50,7 +50,7 @@ namespace ClusteredGeometry { const ATTRIBUTE_SIZE = 8; const MAX_RECURSION_DEPTH = 16; - // core/clas.cpp's operation description (ClasParam) and D3D12's values. + // examples/clustered_geometry/clas.cpp's operation description (ClasParam) and D3D12's values. const CLAS_PARAM_COUNT = 17; const OP_MOVE = 0; const OP_BLAS_FROM_CLAS = 1; @@ -1535,7 +1535,7 @@ namespace ClusteredGeometry { // ---- The GPU side ---------------------------------------------------------------------------- - // core/clas.cpp's operation description. + // examples/clustered_geometry/clas.cpp's operation description. function clasParams(type: int, mode: int, flags: int, maxArgCount: int): int[] { const params: int[] = []; for (let i = 0; i < CLAS_PARAM_COUNT; i++) { diff --git a/core/denoised_rtao.cpp b/examples/denoised_rtao/denoised_rtao.cpp similarity index 99% rename from core/denoised_rtao.cpp rename to examples/denoised_rtao/denoised_rtao.cpp index 5530a75e..4cdc222b 100644 --- a/core/denoised_rtao.cpp +++ b/examples/denoised_rtao/denoised_rtao.cpp @@ -1,6 +1,6 @@ // C++ helpers of the denoised_rtao example (DirectX-Graphics-Samples' // D3D12RaytracingRealTimeDenoisedAmbientOcclusion): its PBRT scenes, loaded with the sample's own -// parser (core/pbrt, based on DuosRenderer) into the sample's vertex layout, and its RTAO sample +// parser (examples/denoised_rtao/pbrt, based on DuosRenderer) into the sample's vertex layout, and its RTAO sample // sets, made by the sample's multi-jittered sampler. Both use the C++ standard library's random // engine and distributions (MSVC's), as the sample does, so they come out the same. // @@ -16,7 +16,7 @@ #include #include -#include "donut_api.h" +#include "../../core/donut_api.h" #pragma comment(lib, "windowscodecs.lib") #pragma comment(lib, "ole32.lib") diff --git a/core/pbrt/PBRTParser.cpp b/examples/denoised_rtao/pbrt/PBRTParser.cpp similarity index 100% rename from core/pbrt/PBRTParser.cpp rename to examples/denoised_rtao/pbrt/PBRTParser.cpp diff --git a/core/pbrt/PBRTParser.h b/examples/denoised_rtao/pbrt/PBRTParser.h similarity index 100% rename from core/pbrt/PBRTParser.h rename to examples/denoised_rtao/pbrt/PBRTParser.h diff --git a/core/pbrt/PlyParser.cpp b/examples/denoised_rtao/pbrt/PlyParser.cpp similarity index 100% rename from core/pbrt/PlyParser.cpp rename to examples/denoised_rtao/pbrt/PlyParser.cpp diff --git a/core/pbrt/PlyParser.h b/examples/denoised_rtao/pbrt/PlyParser.h similarity index 100% rename from core/pbrt/PlyParser.h rename to examples/denoised_rtao/pbrt/PlyParser.h diff --git a/core/pbrt/SceneParser.h b/examples/denoised_rtao/pbrt/SceneParser.h similarity index 100% rename from core/pbrt/SceneParser.h rename to examples/denoised_rtao/pbrt/SceneParser.h diff --git a/core/pbrt/pbrt_stdafx.h b/examples/denoised_rtao/pbrt/pbrt_stdafx.h similarity index 100% rename from core/pbrt/pbrt_stdafx.h rename to examples/denoised_rtao/pbrt/pbrt_stdafx.h diff --git a/examples/denoised_rtao/pbrt_scene.ts b/examples/denoised_rtao/pbrt_scene.ts index 02ae92ac..5f09d830 100644 --- a/examples/denoised_rtao/pbrt_scene.ts +++ b/examples/denoised_rtao/pbrt_scene.ts @@ -1,10 +1,11 @@ // Generated by tools/generate_donut_wrappers.py from donut_interop.d.ts: don't edit, regenerate. // // The classes PbrtScene, Images, Rtao, as in donut.ts, over the Donut_* functions -// core/denoised_rtao.cpp defines, kept out of donut.ts (which every example links) for the examples -// that link core/denoised_rtao.cpp: import with `import { PbrtScene, Images, Rtao } from -// "./pbrt_scene";` (from examples/denoised_rtao/) and list examples/denoised_rtao/pbrt_scene.ts -// with core/denoised_rtao.cpp in the example's add_tslang_example sources. +// examples/denoised_rtao/denoised_rtao.cpp defines, kept out of donut.ts (which every example +// links) for the examples that link examples/denoised_rtao/denoised_rtao.cpp: import with `import { +// PbrtScene, Images, Rtao } from "./pbrt_scene";` (from examples/denoised_rtao/) and list +// examples/denoised_rtao/pbrt_scene.ts with examples/denoised_rtao/denoised_rtao.cpp in the +// example's add_tslang_example sources. /// diff --git a/core/fast_block_compress.cpp b/examples/fast_block_compress/fast_block_compress.cpp similarity index 99% rename from core/fast_block_compress.cpp rename to examples/fast_block_compress/fast_block_compress.cpp index 4fcf84da..d0b8da98 100644 --- a/core/fast_block_compress.cpp +++ b/examples/fast_block_compress/fast_block_compress.cpp @@ -9,7 +9,7 @@ #include #include -#include "donut_api.h" +#include "../../core/donut_api.h" namespace { diff --git a/core/fbc_cpu.cpp b/examples/fast_block_compress/fbc_cpu.cpp similarity index 100% rename from core/fbc_cpu.cpp rename to examples/fast_block_compress/fbc_cpu.cpp diff --git a/core/fbc_cpu.h b/examples/fast_block_compress/fbc_cpu.h similarity index 100% rename from core/fbc_cpu.h rename to examples/fast_block_compress/fbc_cpu.h diff --git a/core/fbc_cpu_compat.h b/examples/fast_block_compress/fbc_cpu_compat.h similarity index 100% rename from core/fbc_cpu_compat.h rename to examples/fast_block_compress/fbc_cpu_compat.h diff --git a/examples/fast_block_compress/fbc_texture.ts b/examples/fast_block_compress/fbc_texture.ts index 0849cfd1..e5ae5520 100644 --- a/examples/fast_block_compress/fbc_texture.ts +++ b/examples/fast_block_compress/fbc_texture.ts @@ -1,10 +1,11 @@ // Generated by tools/generate_donut_wrappers.py from donut_interop.d.ts: don't edit, regenerate. // -// The FbcTexture class, as in donut.ts, over the Donut_* functions core/fast_block_compress.cpp -// defines, kept out of donut.ts (which every example links) for the examples that link -// core/fast_block_compress.cpp: import with `import { FbcTexture } from "./fbc_texture";` (from -// examples/fast_block_compress/) and list examples/fast_block_compress/fbc_texture.ts with -// core/fast_block_compress.cpp in the example's add_tslang_example sources. +// The FbcTexture class, as in donut.ts, over the Donut_* functions +// examples/fast_block_compress/fast_block_compress.cpp defines, kept out of donut.ts (which every +// example links) for the examples that link examples/fast_block_compress/fast_block_compress.cpp: +// import with `import { FbcTexture } from "./fbc_texture";` (from examples/fast_block_compress/) +// and list examples/fast_block_compress/fbc_texture.ts with +// examples/fast_block_compress/fast_block_compress.cpp in the example's add_tslang_example sources. /// @@ -21,8 +22,9 @@ export class FbcTexture { return !this.handle; } - // The Xbox ATG FastBlockCompress sample's CPU side (core/fast_block_compress.cpp with the - // sample's CPU compressor, core/fbc_cpu.cpp, linked only into the examples that list them). A + // The Xbox ATG FastBlockCompress sample's CPU side + // (examples/fast_block_compress/fast_block_compress.cpp with the sample's CPU compressor, + // examples/fast_block_compress/fbc_cpu.cpp, linked only into the examples that list them). A // DDS file in memory (square, a power of two, 32-bit BGRA / BGRX / RGBA) decoded to RGBA8 // levels in the sample's CPU compressor layout (16-byte aligned, natural pitches, 2x2 and 1x1 // replicated to 4x4; X8 alpha read as 255). A null handle on failure; free it with diff --git a/examples/golden_line/golden_line.ts b/examples/golden_line/golden_line.ts index 8e878700..f028d48d 100644 --- a/examples/golden_line/golden_line.ts +++ b/examples/golden_line/golden_line.ts @@ -62,7 +62,7 @@ import { Sound, SoundFrame, SOUND_NONE, SOUND_OFF } from "./golden_line_sound"; // (golden_line_hud.ts, hud.js) shows the hour, the next station, the speed and the buttons; H (or its button) // hides it all for photo mode, a click or Escape brings it back, / shows the keys (-nohud: no HUD; -hud: in // a -test still too). The soundtrack (golden_line_sound.ts, audio/*.js) is synthesised from a bank of samples -// built in code (golden_line_soundbank.ts) through Web Audio's nodes (core/web_audio.cpp, on miniaudio): M +// built in code (golden_line_soundbank.ts) through Web Audio's nodes (examples/golden_line/web_audio.cpp, on miniaudio): M // (or its button) mutes it; -nosound goes without (as a -test does). namespace GoldenLine { // the exposure multiplier of an eye used to the dark (main.js) diff --git a/examples/golden_line/golden_line_sound.ts b/examples/golden_line/golden_line_sound.ts index c9ab0860..34a33175 100644 --- a/examples/golden_line/golden_line_sound.ts +++ b/examples/golden_line/golden_line_sound.ts @@ -1,6 +1,6 @@ // The Golden Line's soundtrack (the original's src/audio: index.js, engine.js, graph.js, spatial.js and // layers/*.js), synthesised from the sound bank (golden_line_soundbank.ts) through Web Audio's nodes -// (core/web_audio.cpp, which renders them as Chrome does): the wheels on the rail joints, the engine's +// (examples/golden_line/web_audio.cpp, which renders them as Chrome does): the wheels on the rail joints, the engine's // exhaust beats and steam, the rolling roar of the train, the chime whistle, the wind, birds and // crickets, and what the window seat adds. Made of the same calls in the same order as the page makes // (a node's number is its place in that order); every frame turns the ride's state into parameter diff --git a/core/web_audio.cpp b/examples/golden_line/web_audio.cpp similarity index 99% rename from core/web_audio.cpp rename to examples/golden_line/web_audio.cpp index 6f5f03ab..8c8939ba 100644 --- a/core/web_audio.cpp +++ b/examples/golden_line/web_audio.cpp @@ -39,7 +39,7 @@ #include #include -#include "donut_api.h" +#include "../../core/donut_api.h" namespace webaudio { diff --git a/examples/golden_line/web_audio.ts b/examples/golden_line/web_audio.ts index c0a53548..9bb6c852 100644 --- a/examples/golden_line/web_audio.ts +++ b/examples/golden_line/web_audio.ts @@ -1,10 +1,10 @@ // Generated by tools/generate_donut_wrappers.py from donut_interop.d.ts: don't edit, regenerate. // -// The WebAudio class, as in donut.ts, over the Donut_* functions core/web_audio.cpp defines, kept -// out of donut.ts (which every example links) for the examples that link core/web_audio.cpp: import -// with `import { WebAudio } from "./web_audio";` (from examples/golden_line/) and list -// examples/golden_line/web_audio.ts with core/web_audio.cpp in the example's add_tslang_example -// sources. +// The WebAudio class, as in donut.ts, over the Donut_* functions examples/golden_line/web_audio.cpp +// defines, kept out of donut.ts (which every example links) for the examples that link +// examples/golden_line/web_audio.cpp: import with `import { WebAudio } from "./web_audio";` (from +// examples/golden_line/) and list examples/golden_line/web_audio.ts with +// examples/golden_line/web_audio.cpp in the example's add_tslang_example sources. /// diff --git a/examples/memory_management/memory_management.ts b/examples/memory_management/memory_management.ts index 38a249fd..0c068dd6 100644 --- a/examples/memory_management/memory_management.ts +++ b/examples/memory_management/memory_management.ts @@ -149,7 +149,7 @@ namespace MemoryManagement { // whose levels are backed by heaps of their own, mapped and filled on a copy queue, made // resident again or evicted by priority (the level visible at the camera's zoom, then the one // above it and the visible ones of images near the view, then everything round-robin), each - // drawn from its most detailed level resident (core/paged_images.cpp). The UI: mip overlays + // drawn from its most detailed level resident (examples/memory_management/paged_images.cpp). The UI: mip overlays // (m), statistics with a memory graph (s), budget overrides in 128 MB steps (+/-), a detached // paging camera (d) and which camera the mouse moves (c), v-sync (v). D3D12 only (residency is // D3D12's: MakeResident / Evict). diff --git a/core/paged_images.cpp b/examples/memory_management/paged_images.cpp similarity index 99% rename from core/paged_images.cpp rename to examples/memory_management/paged_images.cpp index c0244d23..ee86c0a6 100644 --- a/core/paged_images.cpp +++ b/examples/memory_management/paged_images.cpp @@ -41,7 +41,7 @@ #include #include -#include "donut_api.h" +#include "../../core/donut_api.h" using Microsoft::WRL::ComPtr; @@ -955,7 +955,7 @@ struct PagedImageSet extern "C" { // Images streamed into video memory a mip level at a time under the memory budget - // (core/paged_images.cpp, linked only into the examples that list it): DirectX-Graphics-Samples' + // (examples/memory_management/paged_images.cpp, linked only into the examples that list it): DirectX-Graphics-Samples' // D3D12MemoryManagement's paging. Initialize it with Donut_InitPagedImageSet; free it with // Donut_DestroyPagedImageSet before the app. DONUT_API PagedImageSet* Donut_CreatePagedImageSet() diff --git a/examples/memory_management/paged_images.ts b/examples/memory_management/paged_images.ts index 3c45e6a5..1f721e90 100644 --- a/examples/memory_management/paged_images.ts +++ b/examples/memory_management/paged_images.ts @@ -1,10 +1,11 @@ // Generated by tools/generate_donut_wrappers.py from donut_interop.d.ts: don't edit, regenerate. // -// The PagedImageSet class, as in donut.ts, over the Donut_* functions core/paged_images.cpp -// defines, kept out of donut.ts (which every example links) for the examples that link -// core/paged_images.cpp: import with `import { PagedImageSet } from "./paged_images";` (from -// examples/memory_management/) and list examples/memory_management/paged_images.ts with -// core/paged_images.cpp in the example's add_tslang_example sources. +// The PagedImageSet class, as in donut.ts, over the Donut_* functions +// examples/memory_management/paged_images.cpp defines, kept out of donut.ts (which every example +// links) for the examples that link examples/memory_management/paged_images.cpp: import with +// `import { PagedImageSet } from "./paged_images";` (from examples/memory_management/) and list +// examples/memory_management/paged_images.ts with examples/memory_management/paged_images.cpp in +// the example's add_tslang_example sources. /// @@ -22,7 +23,7 @@ export class PagedImageSet { } // Images streamed into video memory a mip level at a time under the memory budget - // (core/paged_images.cpp, linked only into the examples that list it; D3D12): + // (examples/memory_management/paged_images.cpp, linked only into the examples that list it; D3D12): // DirectX-Graphics-Samples' D3D12MemoryManagement's paging: reserved textures, each level backed by // heaps of its own, mapped and filled on a copy queue by a paging thread, made resident again or // evicted by the images' priorities under the DXGI budget. Free it with Donut_DestroyPagedImageSet diff --git a/core/omm_bake.cpp b/examples/opacity_micromaps/omm_bake.cpp similarity index 98% rename from core/omm_bake.cpp rename to examples/opacity_micromaps/omm_bake.cpp index cca80cc4..7a10f03b 100644 --- a/core/omm_bake.cpp +++ b/examples/opacity_micromaps/omm_bake.cpp @@ -20,7 +20,7 @@ #include #include -#include "donut_api.h" +#include "../../core/donut_api.h" #if defined(DONUT_WITH_OMM_SDK) #include @@ -103,7 +103,7 @@ namespace extern "C" { - // The Opacity Micro-Map SDK's GPU baker (core/omm_bake.cpp, linked only into the examples that + // The Opacity Micro-Map SDK's GPU baker (examples/opacity_micromaps/omm_bake.cpp, linked only into the examples that // list it) on the app's device (Donut_GetNvrhiDevice; D3D12 or Vulkan). Returns null without the // SDK (WITH_OMM_SDK, Windows) or on failure. Free it with Donut_DestroyOmmBaker before the app: // it holds its bakes' buffers. diff --git a/examples/opacity_micromaps/omm_bake.ts b/examples/opacity_micromaps/omm_bake.ts index 9e6e7724..efa11202 100644 --- a/examples/opacity_micromaps/omm_bake.ts +++ b/examples/opacity_micromaps/omm_bake.ts @@ -1,10 +1,11 @@ // Generated by tools/generate_donut_wrappers.py from donut_interop.d.ts: don't edit, regenerate. // -// The OmmBaker class, as in donut.ts, over the Donut_* functions core/omm_bake.cpp defines, kept -// out of donut.ts (which every example links) for the examples that link core/omm_bake.cpp: import -// with `import { OmmBaker } from "./omm_bake";` (from examples/opacity_micromaps/) and list -// examples/opacity_micromaps/omm_bake.ts with core/omm_bake.cpp in the example's add_tslang_example -// sources. +// The OmmBaker class, as in donut.ts, over the Donut_* functions +// examples/opacity_micromaps/omm_bake.cpp defines, kept out of donut.ts (which every example links) +// for the examples that link examples/opacity_micromaps/omm_bake.cpp: import with `import { +// OmmBaker } from "./omm_bake";` (from examples/opacity_micromaps/) and list +// examples/opacity_micromaps/omm_bake.ts with examples/opacity_micromaps/omm_bake.cpp in the +// example's add_tslang_example sources. /// @@ -21,7 +22,7 @@ export class OmmBaker { return !this.handle; } - // Opacity micromaps baked at run time (core/omm_bake.cpp, linked only into the examples that list it): + // Opacity micromaps baked at run time (examples/opacity_micromaps/omm_bake.cpp, linked only into the examples that list it): // the GPU baker of NVIDIA's Opacity Micro-Map SDK (fetched at configure time, WITH_OMM_SDK, Windows) // on the app's device (Donut_GetNvrhiDevice; D3D12 or Vulkan). Null without the SDK or on failure. // Free it with Donut_DestroyOmmBaker before the app: it holds its bakes' buffers. diff --git a/examples/opacity_micromaps/opacity_micromaps.ts b/examples/opacity_micromaps/opacity_micromaps.ts index cbc6b8f9..65dff4e8 100644 --- a/examples/opacity_micromaps/opacity_micromaps.ts +++ b/examples/opacity_micromaps/opacity_micromaps.ts @@ -110,7 +110,7 @@ namespace OpacityMicromaps { // the sample's: O micromaps, Q/W level, F state count, R camera rotation, Z/X zoom, A any-hit // shader, H shows where it ran, B rebuilds the acceleration structures every frame. With -bake // the sets are baked at run time instead, by the Opacity Micro-Map SDK's GPU baker - // (core/omm_bake.cpp), each when first selected. + // (examples/opacity_micromaps/omm_bake.cpp), each when first selected. class OpacityMicromapsPass { private app: App; private bindingLayout: BindingLayoutHandle; diff --git a/core/msvc_fast_math.cpp b/examples/raytracing_mini_engine/msvc_fast_math.cpp similarity index 98% rename from core/msvc_fast_math.cpp rename to examples/raytracing_mini_engine/msvc_fast_math.cpp index dddf6c2c..9e7ec847 100644 --- a/core/msvc_fast_math.cpp +++ b/examples/raytracing_mini_engine/msvc_fast_math.cpp @@ -17,7 +17,7 @@ extern "C" __m128 __libm_sse2_sincosf_(float x); #endif -#include "donut_api.h" +#include "../../core/donut_api.h" extern "C" { diff --git a/examples/raytracing_mini_engine.ts b/examples/raytracing_mini_engine/raytracing_mini_engine.ts similarity index 99% rename from examples/raytracing_mini_engine.ts rename to examples/raytracing_mini_engine/raytracing_mini_engine.ts index c782994e..89e40f84 100644 --- a/examples/raytracing_mini_engine.ts +++ b/examples/raytracing_mini_engine/raytracing_mini_engine.ts @@ -1,13 +1,13 @@ // donut.ts (the class wrappers over donut_interop.d.ts) comes in through input_pass.ts: tslang // would load it twice if this file referenced it too. -import { InputPass } from "../core/input_pass"; -import { Args } from "../core/args"; -import { TestCheck, unsupported } from "../core/test_check"; +import { InputPass } from "../../core/input_pass"; +import { Args } from "../../core/args"; +import { TestCheck, unsupported } from "../../core/test_check"; import { XM_2PI, XM_PI, XM_PIDIV2, cross3, dot3, fromRows, matrixInverse, matrixMultiply, matrixRotationQuaternion, matrixRotationX, matrixRotationY, matrixTranspose, normalize3, quaternionConjugate, quaternionRotationMatrix, floor4, reciprocal, reciprocalSqrt, row, transformNormal3, vdiv, vector3Rotate, vmul, -} from "../core/directx_math"; +} from "../../core/directx_math"; namespace RaytracingMiniEngine { const WINDOW_TITLE = "D3D12RaytracingMiniEngineSample"; @@ -459,7 +459,7 @@ namespace RaytracingMiniEngine { // textures and the mesh's index) the instance ID and a bindless texture table. MiniEngine's // camera (FlyingFPSCamera, Camera) and shadow camera are computed as it computes them, to the // last bit (core/directx_math.ts; MSVC's /fp:fast sincos and reciprocal estimates for the sun and - // SSAO's constants: core/msvc_fast_math.cpp). MiniEngine's frame around the ray tracing is ported + // SSAO's constants: examples/raytracing_mini_engine/msvc_fast_math.cpp). MiniEngine's frame around the ray tracing is ported // too: the depth prepass, the sun's shadow map and the color pass (its model shaders, depth // clipping on, TAA's half-pixel viewport offset), SSAO (on by default, as the sample's; -ssao 0 // clears its buffer to 1), and the camera velocities, TAA blend and sharpening MiniEngine runs diff --git a/core/rtxdi.cpp b/examples/rtxdi_minimal/rtxdi.cpp similarity index 98% rename from core/rtxdi.cpp rename to examples/rtxdi_minimal/rtxdi.cpp index 08ffbceb..605aab57 100644 --- a/core/rtxdi.cpp +++ b/examples/rtxdi_minimal/rtxdi.cpp @@ -2,7 +2,7 @@ // a sample's shaders: the ReSTIR DI context of RTXDI's runtime library (rtxdi_runtime in CMakeLists.txt, // compiled from RTXDI_DIR in place) with its neighbor offsets, the scene's ray tracing acceleration structures // and a float dump of a render target. What depends on the Minimal Sample's ShaderParameters.h (its resources, -// light preparation and constants) is core/rtxdi_minimal.cpp's. The values and the behaviour follow the +// light preparation and constants) is examples/rtxdi_minimal/rtxdi_minimal.cpp's. The values and the behaviour follow the // sample's host; the code is this repository's. Built only with RTXDI_DIR. // // This software contains source code provided by NVIDIA Corporation. @@ -32,7 +32,7 @@ #include -#include "donut_api.h" +#include "../../core/donut_api.h" // core/donut_interop.cpp's app, its NVRHI device and its texture readback. struct App; diff --git a/examples/rtxdi_minimal/rtxdi_di.ts b/examples/rtxdi_minimal/rtxdi_di.ts index 23bc4369..74d97caf 100644 --- a/examples/rtxdi_minimal/rtxdi_di.ts +++ b/examples/rtxdi_minimal/rtxdi_di.ts @@ -1,5 +1,5 @@ // RTXDI's ReSTIR DI (github.com/NVIDIA-RTX/RTXDI) on Donut, the parts its samples share: the ReSTIR DI -// context and resources with the light preparation (core/rtxdi.cpp and core/rtxdi_minimal.cpp, over RTXDI's +// context and resources with the light preparation (examples/rtxdi_minimal/rtxdi.cpp and examples/rtxdi_minimal/rtxdi_minimal.cpp, over RTXDI's // runtime library), the G-buffer render targets of the current and the previous frame, and the PrepareLights // pass, which turns the scene's emissive triangles into RTXDI's light buffer; and the Minimal Sample's fused // Render pass with its settings. @@ -7,7 +7,7 @@ // shaders are the sample's, compiled in place from RTXDI_DIR (rtxdi_minimal_shaders in CMakeLists.txt). // // Imported with `import { RtxdiDI, ... } from "./rtxdi_di";` (from examples/); list examples/rtxdi_minimal/rtxdi_di.ts with -// core/rtxdi.cpp and core/rtxdi_minimal.cpp (RTXDI_GLUE_SOURCES) in the example's add_tslang_example sources. +// examples/rtxdi_minimal/rtxdi.cpp and examples/rtxdi_minimal/rtxdi_minimal.cpp (RTXDI_GLUE_SOURCES) in the example's add_tslang_example sources. // // The sample is under the NVIDIA RTX SDKs License. This software contains source code provided by NVIDIA // Corporation. diff --git a/core/rtxdi_minimal.cpp b/examples/rtxdi_minimal/rtxdi_minimal.cpp similarity index 98% rename from core/rtxdi_minimal.cpp rename to examples/rtxdi_minimal/rtxdi_minimal.cpp index 306a75f3..c3570ea6 100644 --- a/core/rtxdi_minimal.cpp +++ b/examples/rtxdi_minimal/rtxdi_minimal.cpp @@ -5,7 +5,7 @@ // create the passes and bind the shaders (RTXDI_DIR's, compiled in place) on them. The structures the shaders // read come from the sample's ShaderParameters.h, included in place (this file's include path, set in // CMakeLists.txt). The values and the behaviour follow the sample's host; the code is this repository's. -// core/rtxdi.cpp has the parts that don't depend on the sample. Built only with RTXDI_DIR. +// examples/rtxdi_minimal/rtxdi.cpp has the parts that don't depend on the sample. Built only with RTXDI_DIR. // // This software contains source code provided by NVIDIA Corporation. // @@ -33,7 +33,7 @@ #include -#include "donut_api.h" +#include "../../core/donut_api.h" // The sample's constant buffer, task and light structures, which its shaders include (ShaderParameters.h, // on donut::math's types). @@ -45,7 +45,7 @@ static_assert(sizeof(RAB_LightInfo) == 32, "RAB_LightInfo is two uint4s"); static_assert(sizeof(PrepareLightsTask) == 16, "PrepareLightsTask is one uint4"); static_assert(sizeof(PrepareLightsConstants) == 4, "PrepareLightsConstants is one uint"); static_assert(sizeof(ResamplingConstants) % 16 == 0, "ResamplingConstants fills whole constant buffer registers"); -// The ray masks examples/rtxdi_minimal/rtxdi_minimal.ts passes to Rtxdi_BuildSceneAccelStructs (core/rtxdi.cpp). +// The ray masks examples/rtxdi_minimal/rtxdi_minimal.ts passes to Rtxdi_BuildSceneAccelStructs (examples/rtxdi_minimal/rtxdi.cpp). static_assert(INSTANCE_MASK_OPAQUE == 1 && INSTANCE_MASK_ALPHA_TESTED == 2 && INSTANCE_MASK_TRANSPARENT == 4, "examples/rtxdi_minimal/rtxdi_minimal.ts's INSTANCE_MASK_* are the shaders'"); diff --git a/examples/rtxdi_minimal/rtxdi_minimal.ts b/examples/rtxdi_minimal/rtxdi_minimal.ts index 47f06122..968b5c0f 100644 --- a/examples/rtxdi_minimal/rtxdi_minimal.ts +++ b/examples/rtxdi_minimal/rtxdi_minimal.ts @@ -51,7 +51,7 @@ namespace RtxdiMinimal { const LIGHT_CENTER = 0; const LIGHT_RADIANCE = 4; - // The ray masks of the sample's ShaderParameters.h (INSTANCE_MASK_*; core/rtxdi_minimal.cpp asserts them): + // The ray masks of the sample's ShaderParameters.h (INSTANCE_MASK_*; examples/rtxdi_minimal/rtxdi_minimal.cpp asserts them): // the TLAS instances' masks by content. const INSTANCE_MASK_OPAQUE = 0x01; const INSTANCE_MASK_ALPHA_TESTED = 0x02; diff --git a/core/rtxmg.cpp b/examples/rtxmg_demo/rtxmg.cpp similarity index 99% rename from core/rtxmg.cpp rename to examples/rtxmg_demo/rtxmg.cpp index 7348ead0..c6a81bc5 100644 --- a/core/rtxmg.cpp +++ b/examples/rtxmg_demo/rtxmg.cpp @@ -74,7 +74,7 @@ #include #endif -#include "donut_api.h" +#include "../../core/donut_api.h" using namespace donut; using namespace donut::math; diff --git a/examples/rtxmg_demo/rtxmg.ts b/examples/rtxmg_demo/rtxmg.ts index d6740d3a..c7608875 100644 --- a/examples/rtxmg_demo/rtxmg.ts +++ b/examples/rtxmg_demo/rtxmg.ts @@ -1,9 +1,10 @@ // Generated by tools/generate_donut_wrappers.py from donut_interop.d.ts: don't edit, regenerate. // -// The RtxmgDemo class, as in donut.ts, over the Donut_* functions core/rtxmg.cpp defines, kept out -// of donut.ts (which every example links) for the examples that link core/rtxmg.cpp: import with -// `import { RtxmgDemo } from "./rtxmg";` (from examples/rtxmg_demo/) and list -// examples/rtxmg_demo/rtxmg.ts with core/rtxmg.cpp in the example's add_tslang_example sources. +// The RtxmgDemo class, as in donut.ts, over the Donut_* functions examples/rtxmg_demo/rtxmg.cpp +// defines, kept out of donut.ts (which every example links) for the examples that link +// examples/rtxmg_demo/rtxmg.cpp: import with `import { RtxmgDemo } from "./rtxmg";` (from +// examples/rtxmg_demo/) and list examples/rtxmg_demo/rtxmg.ts with examples/rtxmg_demo/rtxmg.cpp in +// the example's add_tslang_example sources. /// diff --git a/examples/rtxmg_demo/rtxmg_demo.ts b/examples/rtxmg_demo/rtxmg_demo.ts index fcd8082e..fd72c9b2 100644 --- a/examples/rtxmg_demo/rtxmg_demo.ts +++ b/examples/rtxmg_demo/rtxmg_demo.ts @@ -3,7 +3,7 @@ // rebuilt on the GPU), path traced with accumulation and tone mapped as the demo does. // // The library's work (scene, cluster tessellator, HiZ culling, TLAS, the environment map's sampling -// tables) is core/rtxmg.cpp's, over RTXMG_DIR's library; this file is the demo's app: the path tracer's +// tables) is examples/rtxmg_demo/rtxmg.cpp's, over RTXMG_DIR's library; this file is the demo's app: the path tracer's // pipeline, shader table and binding set, the trace, the blit and the window. Vulkan (its // VK_NV_cluster_acceleration_structure) or D3D12 with NVRHI's DXR cluster build (NVRHI_D3D12_WITH_DXRCLUSTER: // the preview Agility SDK, shader model 6.10, Windows' Developer Mode and driver 621.01+). Run with: @@ -21,7 +21,7 @@ namespace RtxmgDemoExample { // D3D12 path tracer declares (no NVAPI here: only its root signature slot, never written). const NVAPI_SHADER_EXT_SLOT = 1000; - // core/rtxmg.cpp's RtxmgResource and RtxmgTexture. + // examples/rtxmg_demo/rtxmg.cpp's RtxmgResource and RtxmgTexture. const RTXMG_BUFFER_LIGHTING = 0; const RTXMG_BUFFER_RENDER_PARAMS = 1; const RTXMG_BUFFER_INSTANCES = 2; @@ -156,7 +156,7 @@ namespace RtxmgDemoExample { return true; } - // The binding sets over what core/rtxmg.cpp holds now (it makes some of it again as the tessellation + // The binding sets over what examples/rtxmg_demo/rtxmg.cpp holds now (it makes some of it again as the tessellation // grows or the window resizes). private createBindingSets() { const r = this.rtxmg; diff --git a/core/rtxpt.cpp b/examples/rtxpt/rtxpt.cpp similarity index 99% rename from core/rtxpt.cpp rename to examples/rtxpt/rtxpt.cpp index 29256d60..ffb59d9e 100644 --- a/core/rtxpt.cpp +++ b/examples/rtxpt/rtxpt.cpp @@ -76,7 +76,7 @@ #include #include -#include "donut_api.h" +#include "../../core/donut_api.h" using namespace donut; using namespace donut::math; diff --git a/examples/rtxpt/rtxpt.ts b/examples/rtxpt/rtxpt.ts index e6a78504..df18f133 100644 --- a/examples/rtxpt/rtxpt.ts +++ b/examples/rtxpt/rtxpt.ts @@ -14,7 +14,7 @@ import { RtxptGame, GameWorld } from "../../core/rtxpt_game"; // // This file is the sample's host (Sample.cpp, AdvancedSample.cpp): its settings (SampleUIData, the // "Balanced" performance preset), the camera, the path tracer's shader macros, the accumulation and when -// to rebuild what. core/rtxpt.cpp holds the sample's renderer library (compiled from the checkout) and +// to rebuild what. examples/rtxpt/rtxpt.cpp holds the sample's renderer library (compiled from the checkout) and // does the steps: the scene, materials, NEE-AT lights and environment map, the acceleration structures, the // path tracing passes (compiled at run time per material), accumulation or the denoiser and TAA, bloom and // tone mapping. Of the real-time mode, ReSTIR, SHaRC and sub-sampling are not ported. Its AA is the sample's @@ -48,7 +48,7 @@ namespace Rtxpt { Ready = 3 } - // RtxptFrameSettings (core/rtxpt.cpp), as byte offsets; all fields 4 bytes. + // RtxptFrameSettings (examples/rtxpt/rtxpt.cpp), as byte offsets; all fields 4 bytes. const FRAME_SETTINGS_SIZE = 280; const FS_CAMERA_POS = 0; const FS_FOV_Y = 12; @@ -156,7 +156,7 @@ namespace Rtxpt { return x != x; } - // A struct written as 4-byte fields at byte offsets, for core/rtxpt.cpp to read. + // A struct written as 4-byte fields at byte offsets, for examples/rtxpt/rtxpt.cpp to read. class ConstantBlock { data: f32[] = []; byteSize: int; @@ -394,7 +394,7 @@ namespace Rtxpt { private cameraVerticalFov = 1.0471975511965976; private cameraZNear = 0.001; - // DLSS and DLSS-RR (the real-time mode's realtimeAA 2 and 3, run by core/rtxpt.cpp) and DLSS-NR (null handles + // DLSS and DLSS-RR (the real-time mode's realtimeAA 2 and 3, run by examples/rtxpt/rtxpt.cpp) and DLSS-NR (null handles // without support), the window size they're set up for, and whether DLSS-NR ran last frame (else it starts // without history). The frames' size (the DLSS mode's with DLSS or DLSS-RR, else the window's), and the DLSS // mode's size for the window (optimalKey: the window size and mode it is for). @@ -662,7 +662,7 @@ namespace Rtxpt { return 1; } - // Sample::GetPTPipelineGlobalMacros (the lights baker adds its own in core/rtxpt.cpp). + // Sample::GetPTPipelineGlobalMacros (the lights baker adds its own in examples/rtxpt/rtxpt.cpp). private updateShaderMacros() { const s = this.settings; const names: string[] = []; @@ -712,7 +712,7 @@ namespace Rtxpt { } } - // Sample::Animate, then the setup Sample::Render does before recording (core/rtxpt.cpp executes command + // Sample::Animate, then the setup Sample::Render does before recording (examples/rtxpt/rtxpt.cpp executes command // lists of its own for it, which it can't while the frame's is open). onAnimate(elapsedSeconds: number) { // The loading's steps between frames (they execute command lists of their own), then the renderer's setup diff --git a/examples/rtxpt/rtxpt_renderer.ts b/examples/rtxpt/rtxpt_renderer.ts index e747dd31..df218a02 100644 --- a/examples/rtxpt/rtxpt_renderer.ts +++ b/examples/rtxpt/rtxpt_renderer.ts @@ -1,9 +1,10 @@ // Generated by tools/generate_donut_wrappers.py from donut_interop.d.ts: don't edit, regenerate. // -// The RtxptRenderer class, as in donut.ts, over the Donut_* functions core/rtxpt.cpp defines, kept -// out of donut.ts (which every example links) for the examples that link core/rtxpt.cpp: import -// with `import { RtxptRenderer } from "./rtxpt_renderer";` (from examples/rtxpt/) and list -// examples/rtxpt/rtxpt_renderer.ts with core/rtxpt.cpp in the example's add_tslang_example sources. +// The RtxptRenderer class, as in donut.ts, over the Donut_* functions examples/rtxpt/rtxpt.cpp +// defines, kept out of donut.ts (which every example links) for the examples that link +// examples/rtxpt/rtxpt.cpp: import with `import { RtxptRenderer } from "./rtxpt_renderer";` (from +// examples/rtxpt/) and list examples/rtxpt/rtxpt_renderer.ts with examples/rtxpt/rtxpt.cpp in the +// example's add_tslang_example sources. /// diff --git a/core/obj_model.cpp b/examples/sakura_forest_ser/obj_model.cpp similarity index 99% rename from core/obj_model.cpp rename to examples/sakura_forest_ser/obj_model.cpp index 32176ca8..b10ef15a 100644 --- a/core/obj_model.cpp +++ b/examples/sakura_forest_ser/obj_model.cpp @@ -16,7 +16,7 @@ #include #include -#include "donut_api.h" +#include "../../core/donut_api.h" namespace { diff --git a/examples/sakura_forest_ser/obj_model.ts b/examples/sakura_forest_ser/obj_model.ts index 2d851d1a..a6e447a0 100644 --- a/examples/sakura_forest_ser/obj_model.ts +++ b/examples/sakura_forest_ser/obj_model.ts @@ -1,10 +1,11 @@ // Generated by tools/generate_donut_wrappers.py from donut_interop.d.ts: don't edit, regenerate. // -// The ObjModel class, as in donut.ts, over the Donut_* functions core/obj_model.cpp defines, kept -// out of donut.ts (which every example links) for the examples that link core/obj_model.cpp: import -// with `import { ObjModel } from "./obj_model";` (from examples/sakura_forest_ser/) and list -// examples/sakura_forest_ser/obj_model.ts with core/obj_model.cpp in the example's -// add_tslang_example sources. +// The ObjModel class, as in donut.ts, over the Donut_* functions +// examples/sakura_forest_ser/obj_model.cpp defines, kept out of donut.ts (which every example +// links) for the examples that link examples/sakura_forest_ser/obj_model.cpp: import with `import { +// ObjModel } from "./obj_model";` (from examples/sakura_forest_ser/) and list +// examples/sakura_forest_ser/obj_model.ts with examples/sakura_forest_ser/obj_model.cpp in the +// example's add_tslang_example sources. /// @@ -21,7 +22,7 @@ export class ObjModel { return !this.handle; } - // Wavefront OBJ models (core/obj_model.cpp, linked only into the examples that list it): + // Wavefront OBJ models (examples/sakura_forest_ser/obj_model.cpp, linked only into the examples that list it): // DirectX-Graphics-Samples' D3D12RaytracingSakuraForestSER loader (ObjModelLoader), objects by their // `o` names, then an object's triangles as three vertices each. Free it with Donut_DestroyObjModel. static create(): ObjModel { diff --git a/core/streamline.cpp b/examples/streamline_demo/streamline.cpp similarity index 99% rename from core/streamline.cpp rename to examples/streamline_demo/streamline.cpp index 50c32d57..78719f06 100644 --- a/core/streamline.cpp +++ b/examples/streamline_demo/streamline.cpp @@ -45,7 +45,7 @@ #include #include -#include "donut_api.h" +#include "../../core/donut_api.h" #include diff --git a/examples/streamline_demo.ts b/examples/streamline_demo/streamline_demo.ts similarity index 99% rename from examples/streamline_demo.ts rename to examples/streamline_demo/streamline_demo.ts index f1d10ea4..3a7f747c 100644 --- a/examples/streamline_demo.ts +++ b/examples/streamline_demo/streamline_demo.ts @@ -1,11 +1,11 @@ // donut.ts (the class wrappers over donut_interop.d.ts) comes in through input_pass.ts: tslang // would load it twice if this file referenced it too. -import { InputPass } from "../core/input_pass"; -import { Args } from "../core/args"; -import { TestCheck, unsupported } from "../core/test_check"; -import { radiansF32 } from "../core/matrix"; +import { InputPass } from "../../core/input_pass"; +import { Args } from "../../core/args"; +import { TestCheck, unsupported } from "../../core/test_check"; +import { radiansF32 } from "../../core/matrix"; -// NVIDIA Streamline (github.com/NVIDIA-RTX/Streamline) on Donut: core/streamline.cpp loads its interposer and +// NVIDIA Streamline (github.com/NVIDIA-RTX/Streamline) on Donut: examples/streamline_demo/streamline.cpp loads its interposer and // plugins from bin/streamline/ and hooks the app's device creation (AppOptions.Streamline). The frame is the // Streamline Sample's (github.com/NVIDIA-RTX/Streamline_Sample, its StreamlineSample::RenderScene): Sponza // with a dancing robot, cascaded shadow maps, a G-buffer, then ray traced lighting (the sample's ray @@ -13,7 +13,7 @@ import { radiansF32 } from "../core/matrix"; // procedural sky, bloom, DLSS-SR, TAA or none (then optionally DLSS Ray Reconstruction), tone mapping with // auto exposure, and optionally DeepDVC; DLSS Frame Generation at present, with the UI drawn into a layer // of its own (its color and alpha), put over the frame and tagged for it. Streamline's frame token, -// Reflex and PCL markers come from the device manager's frame callbacks (core/streamline.cpp). +// Reflex and PCL markers come from the device manager's frame callbacks (examples/streamline_demo/streamline.cpp). namespace StreamlineDemo { // Test mode: the frames rendered: the last one is the sample's frame 120 (its reference frames', at // 1/60 s a frame), the 121st it renders. diff --git a/core/video_player.cpp b/examples/video_texture/video_player.cpp similarity index 99% rename from core/video_player.cpp rename to examples/video_texture/video_player.cpp index 36101c8e..6bd2cd5b 100644 --- a/core/video_player.cpp +++ b/examples/video_texture/video_player.cpp @@ -23,7 +23,7 @@ #include #include -#include "donut_api.h" +#include "../../core/donut_api.h" #pragma comment(lib, "d3d11.lib") #pragma comment(lib, "dxgi.lib") diff --git a/examples/video_texture/video_player.ts b/examples/video_texture/video_player.ts index 6386c733..09b5a4c6 100644 --- a/examples/video_texture/video_player.ts +++ b/examples/video_texture/video_player.ts @@ -1,10 +1,11 @@ // Generated by tools/generate_donut_wrappers.py from donut_interop.d.ts: don't edit, regenerate. // -// The VideoPlayer class, as in donut.ts, over the Donut_* functions core/video_player.cpp defines, -// kept out of donut.ts (which every example links) for the examples that link -// core/video_player.cpp: import with `import { VideoPlayer } from "./video_player";` (from -// examples/video_texture/) and list examples/video_texture/video_player.ts with -// core/video_player.cpp in the example's add_tslang_example sources. +// The VideoPlayer class, as in donut.ts, over the Donut_* functions +// examples/video_texture/video_player.cpp defines, kept out of donut.ts (which every example links) +// for the examples that link examples/video_texture/video_player.cpp: import with `import { +// VideoPlayer } from "./video_player";` (from examples/video_texture/) and list +// examples/video_texture/video_player.ts with examples/video_texture/video_player.cpp in the +// example's add_tslang_example sources. /// @@ -21,7 +22,7 @@ export class VideoPlayer { return !this.handle; } - // The Xbox ATG VideoTexturePC12 sample's MediaEnginePlayer (core/video_player.cpp, linked only into + // The Xbox ATG VideoTexturePC12 sample's MediaEnginePlayer (examples/video_texture/video_player.cpp, linked only into // the examples that list it; Windows): Media Foundation's Media Engine playing a video file (path // relative to the executable's directory) on a D3D11 device of the adapter with this LUID // (Donut_GetAdapterLuid; 0, 0: any), muted or not, playing as soon as it can. Null (after printing diff --git a/run_jit_rtxdi.bat b/run_jit_rtxdi.bat index f2642b17..9ecb42b7 100644 --- a/run_jit_rtxdi.bat +++ b/run_jit_rtxdi.bat @@ -1,5 +1,5 @@ @rem Runs the RTXDI Minimal Sample under the JIT (run_jit_rtxdi.bat [args]), against %D%: donut_interop_shared.dll (with -@rem core/rtxdi.cpp and core/rtxdi_minimal.cpp, from a build with RTXDI_DIR). From the repo root. Runs on D3D12 (-dx12 is hardcoded: edit it for Vulkan). +@rem examples/rtxdi_minimal/rtxdi.cpp and examples/rtxdi_minimal/rtxdi_minimal.cpp, from a build with RTXDI_DIR). From the repo root. Runs on D3D12 (-dx12 is hardcoded: edit it for Vulkan). @pushd %~dp0 set D=build-rtxdi/bin "tslang.exe" --shared-libs=%D%/donut_interop_shared.dll examples/rtxdi_minimal/rtxdi_minimal.ts -- -dx12 %* diff --git a/run_jit_streamline.bat b/run_jit_streamline.bat index cc4a6658..40b01b25 100644 --- a/run_jit_streamline.bat +++ b/run_jit_streamline.bat @@ -3,5 +3,5 @@ @pushd %~dp0 rem set D=build-release-streamline/bin set D=build-streamline/bin -"tslang.exe" --shared-libs=%D%/donut_interop_shared.dll examples/streamline_demo.ts -- -dx12 %* +"tslang.exe" --shared-libs=%D%/donut_interop_shared.dll examples/streamline_demo/streamline_demo.ts -- -dx12 %* @popd diff --git a/tools/check_interop_types.py b/tools/check_interop_types.py index a2b134d4..c6e79b2f 100644 --- a/tools/check_interop_types.py +++ b/tools/check_interop_types.py @@ -1,7 +1,7 @@ """Checks that core/donut_interop.d.ts declares the interop functions as the C++ defines them. -Every Donut_* (and Streamline_*, core/streamline.cpp's, and Rtxdi_*, core/rtxdi.cpp's and core/rtxdi_minimal.cpp's) function defined in an `extern "C"` block of -core/*.cpp must be declared in +Every Donut_* (and Streamline_*, examples/streamline_demo/streamline.cpp's, and Rtxdi_*, examples/rtxdi_minimal/rtxdi.cpp's and examples/rtxdi_minimal/rtxdi_minimal.cpp's) function defined in an `extern "C"` block of +core/*.cpp and examples/*/*.cpp must be declared in donut_interop.d.ts with the same parameters, and each C++ type must map to the TypeScript type TYPES (or HANDLES, for object pointers) gives it. The callback types (RenderFn <-> RenderCallback, ...) are compared the same way. @@ -236,7 +236,8 @@ def parse_cpp(root): functions = {} callbacks = {} unexported = [] - for path in sorted(glob.glob(os.path.join(root, "core", "*.cpp"))): + for path in sorted(glob.glob(os.path.join(root, "core", "*.cpp")) + + glob.glob(os.path.join(root, "examples", "*", "*.cpp"))): with open(path, encoding="utf-8") as f: text = f.read() rel = os.path.relpath(path, root).replace("\\", "/") diff --git a/tools/generate_donut_wrappers.py b/tools/generate_donut_wrappers.py index 22fcee7c..dc0124b0 100644 --- a/tools/generate_donut_wrappers.py +++ b/tools/generate_donut_wrappers.py @@ -119,26 +119,26 @@ # Classes whose functions an optional C++ file defines -> (module in core/, that file): emitted into # the module rather than donut.ts, for the examples linking the file to import. MODULES = { - "PbrtScene": ("pbrt_scene", "core/denoised_rtao.cpp"), + "PbrtScene": ("pbrt_scene", "examples/denoised_rtao/denoised_rtao.cpp"), "RtxcrScene": ("rtxcr_scene", "core/rtxcr.cpp"), "RtxcrNrd": ("rtxcr_scene", "core/rtxcr.cpp"), - "RtxmgDemo": ("rtxmg", "core/rtxmg.cpp"), - "RtxptRenderer": ("rtxpt_renderer", "core/rtxpt.cpp"), + "RtxmgDemo": ("rtxmg", "examples/rtxmg_demo/rtxmg.cpp"), + "RtxptRenderer": ("rtxpt_renderer", "examples/rtxpt/rtxpt.cpp"), "SdkMesh": ("sdk_mesh", "core/sdkmesh.cpp"), "MeshletModel": ("meshlet_model", "core/meshlet_model.cpp"), - "ObjModel": ("obj_model", "core/obj_model.cpp"), - "PagedImageSet": ("paged_images", "core/paged_images.cpp"), - "OmmBaker": ("omm_bake", "core/omm_bake.cpp"), + "ObjModel": ("obj_model", "examples/sakura_forest_ser/obj_model.cpp"), + "PagedImageSet": ("paged_images", "examples/memory_management/paged_images.cpp"), + "OmmBaker": ("omm_bake", "examples/opacity_micromaps/omm_bake.cpp"), "Ptlas": ("ptlas", "core/ptlas.cpp"), - "WebAudio": ("web_audio", "core/web_audio.cpp"), - "Clas": ("clas", "core/clas.cpp"), - "FbcTexture": ("fbc_texture", "core/fast_block_compress.cpp"), + "WebAudio": ("web_audio", "examples/golden_line/web_audio.cpp"), + "Clas": ("clas", "examples/clustered_geometry/clas.cpp"), + "FbcTexture": ("fbc_texture", "examples/fast_block_compress/fast_block_compress.cpp"), "TranscodedTexture": ("transcoded_texture", "core/basis_transcoder.cpp"), - "VideoPlayer": ("video_player", "core/video_player.cpp"), + "VideoPlayer": ("video_player", "examples/video_texture/video_player.cpp"), "DirectXCollision": ("directx_collision", "core/directx_collision.cpp"), "Rotation": ("directx_collision", "core/directx_collision.cpp"), - "Rtao": ("pbrt_scene", "core/denoised_rtao.cpp"), - "Images": ("pbrt_scene", "core/denoised_rtao.cpp"), + "Rtao": ("pbrt_scene", "examples/denoised_rtao/denoised_rtao.cpp"), + "Images": ("pbrt_scene", "examples/denoised_rtao/denoised_rtao.cpp"), } # Further parameter names that hold one of those objects. @@ -447,7 +447,7 @@ def parse(source): match = re.match(r"declare function (\w+)\((.*)\)\s*:\s*(.+);$", text) if not match: sys.exit(f"can't parse: {text}") - # Only the Donut_* functions are wrapped: others (core/streamline.cpp's Streamline_*) stay + # Only the Donut_* functions are wrapped: others (examples/streamline_demo/streamline.cpp's Streamline_*) stay # free functions. if not match.group(1).startswith("Donut_"): comments = []