Table of Contents

Class InMemoryIncludeResolver

Namespace
ShadowDusk.Core.Preprocessor
Assembly
ShadowDusk.Core.dll

An IIncludeResolver that resolves #include directives from an in-memory dictionary of file path → contents, with no disk access. Ideal for the WASM/in-browser host and for tests, where the entire shader source set is held in memory.

public sealed class InMemoryIncludeResolver : IIncludeResolver
Inheritance
InMemoryIncludeResolver
Implements
Inherited Members

Constructors

InMemoryIncludeResolver(IReadOnlyDictionary<string, string>)

Creates a resolver over the given map of file path → source text. Keys are matched using forward-slash-normalized paths.

public InMemoryIncludeResolver(IReadOnlyDictionary<string, string> files)

Parameters

files IReadOnlyDictionary<string, string>

The virtual file set: path → contents.

Methods

Resolve(string, string?, IReadOnlyList<string>)

Resolves a single #include reference to its file path and contents.

public Result<IncludeResolvedFile, ShaderError> Resolve(string includePath, string? includingFilePath, IReadOnlyList<string> additionalSearchPaths)

Parameters

includePath string

The path as written in the #include directive.

includingFilePath string

The file that issued the #include, or null.

additionalSearchPaths IReadOnlyList<string>

Extra directories to search, in order.

Returns

Result<IncludeResolvedFile, ShaderError>

The resolved file (path + text) on success, or a ShaderError (e.g. IncludeNotFound) on failure.