Table of Contents

Class EffectBytecode

Namespace
Stride.Shaders
Assembly
Stride.Shaders.dll

Represents a compiled Effect with bytecode for each Shader stage (vertex, pixel, geometry, etc.)

[DataContract]
[ContentSerializer(typeof(DataContentSerializer<EffectBytecode>))]
public sealed class EffectBytecode
Inheritance
object
EffectBytecode
Extension Methods

Fields

HashSources

A collection of each of the Effect Shader source URIs and their associated ObjectIds.

public HashSourceCollection HashSources

Field Value

HashSourceCollection

MagicHeader

A constant value representing the magic header stored in front of an Effect bytecode to avoid reading old versions.

public const uint MagicHeader = 4026449927

Field Value

uint

Reflection

The reflection data extracted from the Effect bytecode.

public EffectReflection Reflection

Field Value

EffectReflection

Stages

The Effect bytecode for each of the Shader stages.

public ShaderBytecode[] Stages

Field Value

ShaderBytecode[]

Methods

ComputeId()

Computes a unique identifier for the Effect bytecode.

public ObjectId ComputeId()

Returns

ObjectId

An unique ObjectId for the Effect bytecode.

FromBytes(byte[])

Loads an EffectBytecode from a buffer.

public static EffectBytecode FromBytes(byte[] buffer)

Parameters

buffer byte[]

The buffer to read from.

Returns

EffectBytecode

The loaded Effect bytecode.

Exceptions

ArgumentNullException

buffer is null.

FromBytesSafe(byte[])

Loads an EffectBytecode from a buffer.

public static EffectBytecode FromBytesSafe(byte[] buffer)

Parameters

buffer byte[]

The buffer to read from.

Returns

EffectBytecode

The loaded Effect bytecode.

Exceptions

ArgumentNullException

buffer is null.

ArgumentException

buffer contains invalid Effect bytecode.

FromStream(Stream)

Loads an EffectBytecode from a stream.

public static EffectBytecode FromStream(Stream stream)

Parameters

stream Stream

The stream to read from.

Returns

EffectBytecode

The loaded Effect bytecode, or null if the magic header is not matching.

Exceptions

ArgumentNullException

stream is null.

WriteTo(Stream)

Writes the EffectBytecode to a stream with its magic number.

public void WriteTo(Stream stream)

Parameters

stream Stream

The stream to write to.

Exceptions

ArgumentNullException

stream is null.