Table of Contents

Class SkSl

Namespace
DrawnUi.Infrastructure
Assembly
DrawnUi.Maui.dll
public static class SkSl
Inheritance
SkSl
Inherited Members

Fields

CompiledCache

Provides a thread-safe cache of compiled runtime effects, indexed by their string identifiers.

public static ConcurrentDictionary<string, SKRuntimeEffect> CompiledCache

Field Value

ConcurrentDictionary<string, SKRuntimeEffect>

Remarks

This static field enables efficient reuse of compiled SKRuntimeEffect instances by storing them for quick retrieval. Access to the cache is thread-safe, allowing concurrent read and write operations from multiple threads without additional synchronization.

Methods

Compile(string)

Will compile your SKSL shader code into SKRuntimeEffect.

public static SKRuntimeEffect Compile(string shaderCode)

Parameters

shaderCode string

Returns

SKRuntimeEffect

Compile(string, string, bool, Action<string>)

Will compile your SKSL shader code into SKRuntimeEffect. The filename parameter is used for debugging and caching. Do not forget to disable caching if you edit/change shader code at runtime.

public static SKRuntimeEffect Compile(string shaderCode, string filename, bool useCache = true, Action<string> onError = null)

Parameters

shaderCode string
filename string
useCache bool
onError Action<string>

Returns

SKRuntimeEffect

CreateShader(SKRuntimeEffect, SKRuntimeEffectUniforms, Dictionary<string, SKShader>)

public static SKShader CreateShader(SKRuntimeEffect compiled, SKRuntimeEffectUniforms uniforms, Dictionary<string, SKShader> textures)

Parameters

compiled SKRuntimeEffect
uniforms SKRuntimeEffectUniforms
textures Dictionary<string, SKShader>

Returns

SKShader

LoadFromResources(string)

public static string LoadFromResources(string fileName)

Parameters

fileName string

Returns

string

LoadFromResourcesAsync(string)

public static Task<string> LoadFromResourcesAsync(string fileName)

Parameters

fileName string

Returns

Task<string>

Precompile(params string[])

public static void Precompile(params string[] filenames)

Parameters

filenames string[]

ThrowCompilationError(string, string, string)

public static void ThrowCompilationError(string shaderCode, string errors, string filename = null)

Parameters

shaderCode string
errors string
filename string