Table of Contents

Class SpirvCrossGlslTranspiler

Namespace
ShadowDusk.GLSL
Assembly
ShadowDusk.GLSL.dll

The default desktop ISpirvToGlslTranspiler: transpiles SPIR-V to GLSL using the native SPIRV-Cross library (via P/Invoke). This is the faithful pipeline's SPIR-V → GLSL leg; the result is then rewritten into MonoGame's GLSL dialect by MonoGameGlslRewriter.

public sealed class SpirvCrossGlslTranspiler : ISpirvToGlslTranspiler
Inheritance
SpirvCrossGlslTranspiler
Implements
Inherited Members

Constructors

SpirvCrossGlslTranspiler()

Creates the transpiler, ensuring the native SPIRV-Cross library is registered/loaded.

public SpirvCrossGlslTranspiler()

Methods

Transpile(ReadOnlyMemory<byte>, CancellationToken)

Transpiles a SPIR-V module to GLSL source.

public Result<GlslSource, ShaderError> Transpile(ReadOnlyMemory<byte> spirvBytes, CancellationToken cancellationToken = default)

Parameters

spirvBytes ReadOnlyMemory<byte>

A complete SPIR-V module (little-endian word stream).

cancellationToken CancellationToken

A cancellation token.

Returns

Result<GlslSource, ShaderError>

The transpiled GlslSource on success, or a ShaderError on failure.

Transpile(ReadOnlySpan<uint>, CancellationToken)

Transpiles a SPIR-V module, supplied as a span of 32-bit words, to GLSL source.

public Result<GlslSource, ShaderError> Transpile(ReadOnlySpan<uint> spirvWords, CancellationToken cancellationToken = default)

Parameters

spirvWords ReadOnlySpan<uint>

The SPIR-V module as little-endian 32-bit words.

cancellationToken CancellationToken

A cancellation token.

Returns

Result<GlslSource, ShaderError>

The transpiled GlslSource, or a ShaderError on failure.