Table of Contents

Class DynamicShader

Namespace
OmegaEngine.Graphics.Shaders
Assembly
OmegaEngine.dll

Helper class for compiling Shader code at runtime

public static class DynamicShader
Inheritance
object
DynamicShader

Remarks

Uses .fx files containing HLSL that generates different variants depending on preprocessor defines.

Properties

Cache

Caches compiled shaders on disk across application runs; null to always compile.

public static ShaderCache? Cache { get; set; }

Property Value

ShaderCache

Methods

FromContent(string, IReadOnlyDictionary<string, string>)

Loads a dynamic shader file via the ContentManager and compiles it, or gets it from the Cache.

public static byte[] FromContent(string id, IReadOnlyDictionary<string, string> defines)

Parameters

id string

The ID of the shader to be loaded

defines IReadOnlyDictionary<string, string>

Preprocessor macros (name and definition) that select the variant of the shader to compile

Returns

byte[]

The compiled effect bytecode

Exceptions

ShaderCompileException

The shader code could not be compiled.