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
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
shaderCodestring
Returns
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
Returns
CreateShader(SKRuntimeEffect, SKRuntimeEffectUniforms, Dictionary<string, SKShader>)
public static SKShader CreateShader(SKRuntimeEffect compiled, SKRuntimeEffectUniforms uniforms, Dictionary<string, SKShader> textures)
Parameters
compiledSKRuntimeEffectuniformsSKRuntimeEffectUniformstexturesDictionary<string, SKShader>
Returns
LoadFromResources(string)
public static string LoadFromResources(string fileName)
Parameters
fileNamestring
Returns
LoadFromResourcesAsync(string)
public static Task<string> LoadFromResourcesAsync(string fileName)
Parameters
fileNamestring
Returns
Precompile(params string[])
public static void Precompile(params string[] filenames)
Parameters
filenamesstring[]
ThrowCompilationError(string, string, string)
public static void ThrowCompilationError(string shaderCode, string errors, string filename = null)