Header menu logo Mibo

ShaderLoader Module

Loads compiled MonoGame effect (.mgfx) files from embedded resources.

The Mibo.MonoGame.fsproj embeds compiled shader variants for four backends: .dx.mgfx (DirectX 11), .dx12.mgfx (DirectX 12), .ogl.mgfx (OpenGL), and .vk.mgfx (Vulkan).

Platform detection uses MonoGame.Framework.Utilities.PlatformInfo.GraphicsBackend to pick the appropriate variant.

Compiled shader bytes are cached; a new Effect is instantiated per call so each LightContext2D owns and disposes its own instance.

Functions and values

Function or value Description

loadEffect gd name

Full Usage: loadEffect gd name

Parameters:
    gd : GraphicsDevice - The graphics device to create the effect on.
    name : string - Base name of the effect (e.g. "LitSprite" or "LitSpriteNormalMap").

Returns: Effect voption A new Effect, or ValueNone if the resource is missing.

Loads a compiled MonoGame effect from an embedded .mgfx resource.

Each call returns a fresh Effect owned by the caller; cached bytes are reused.

gd : GraphicsDevice

The graphics device to create the effect on.

name : string

Base name of the effect (e.g. "LitSprite" or "LitSpriteNormalMap").

Returns: Effect voption

A new Effect, or ValueNone if the resource is missing.

Type something to start searching.