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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 101 additions & 88 deletions CMakeLists.txt

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions core/donut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions core/donut_interop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void(nvrhi::GraphicsAPI, donut::app::DeviceCreationParameters&)> g_StreamlineConfigureDevice;
// Also Streamline_Init's: what AppOptions.Streamline does to the new app's device manager (its frame
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion core/donut_interop.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/<module>.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
Expand Down
2 changes: 1 addition & 1 deletion core/interop/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions core/interop/clas.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/// <reference path="../donut_handles.d.ts" />
// 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
Expand All @@ -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<int>): 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
Expand Down
2 changes: 1 addition & 1 deletion core/interop/denoised_rtao.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// <reference path="../donut_handles.d.ts" />
// 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; }
Expand Down
2 changes: 1 addition & 1 deletion core/interop/device.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions core/interop/fast_block_compress.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/// <reference path="../donut_handles.d.ts" />
/// <reference path="resources.d.ts" />
// 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.
Expand Down
4 changes: 2 additions & 2 deletions core/interop/math.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<f32>): 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<float>(a, b).
@nodrops declare function Donut_RandomUniformFloat(randomEngine: RandomEngineHandle, a: number, b: number): number;
Expand Down
4 changes: 2 additions & 2 deletions core/interop/obj_model.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/// <reference path="../donut_handles.d.ts" />
// 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;
Expand Down
4 changes: 2 additions & 2 deletions core/interop/omm_bake.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/// <reference path="../donut_handles.d.ts" />
/// <reference path="resources.d.ts" />
// 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.
Expand Down
4 changes: 2 additions & 2 deletions core/interop/paged_images.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/// <reference path="../donut_handles.d.ts" />
// 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
Expand Down
2 changes: 1 addition & 1 deletion core/interop/raytracing.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/interop/rtxdi.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// <reference path="../donut_handles.d.ts" />
// 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).
Expand Down
6 changes: 3 additions & 3 deletions core/interop/rtxdi_minimal.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path="../donut_handles.d.ts" />
// 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; }
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions core/interop/rtxmg.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// <reference path="../donut_handles.d.ts" />
// 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; }
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions core/interop/rtxpt.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// <reference path="../donut_handles.d.ts" />
// 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; }
Expand Down Expand Up @@ -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<f32>): boolean;
// The path tracer (the frame settings' samples per pixel): the reference one, or in real-time mode the denoising
Expand Down
2 changes: 1 addition & 1 deletion core/interop/streamline.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path="../donut_handles.d.ts" />
/// <reference path="app.d.ts" />
// 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).
Expand Down
4 changes: 2 additions & 2 deletions core/interop/video_player.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/// <reference path="../donut_handles.d.ts" />
// 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
Expand Down
2 changes: 1 addition & 1 deletion core/interop/web_audio.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// <reference path="../donut_handles.d.ts" />
// 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;
Expand Down
2 changes: 1 addition & 1 deletion core/rtxpt_game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <assets>/SampleGame/<scene file name without .json>.
sceneLoaded(world: GameWorld, scenePath: string, assetsPath: string, propShowTags: string, propCameraAttach: string) {
this.deinitialize();
Expand Down
Loading
Loading