FOnline Engine
Current master GitHub
Documentation Docs/en/reference/effect-format/baking.md

Effect Baking And Backends

Generated reference. Do not edit directly. Update BuildTools/EffectFormatInterface.json, then run python BuildTools/docs_effect_format.py --write.

Index Syntax Render state Resources Baking Runtime Validation Canonical JSON Guide

Every pass produces one metadata file and seven flavors per shader stage. The original .fofx source is copied to baked resources because the runtime still reads [Effect] state from it.

Stage flavors: spv, spv_sdl, glsl, glsl_es, hlsl, msl_mac, msl_ios

Stable ID Rule Requirement Why Source
effect-format.baking.compiler-prelude Generated shader prelude The baker prepends ‘#version <Version> es’, ‘precision highp float’, MAX_SCRIPT_VALUES, and, in 3D builds, MAX_BONES and MAX_TEXTURES before ShaderCommon and stage text. Authored shaders share one compile-time shape contract and must not duplicate these directives. Source/Tools/EffectBaker.cpp
effect-format.baking.compiler-target glslang target environment Both stages compile as GLSL for a Vulkan 1.0 client and SPIR-V 1.0 target, then link and build reflection once per pass. All backend flavors derive from the same validated linked program. Source/Tools/EffectBaker.cpp
effect-format.baking.link-interface Stage interface validation Vertex and fragment stages must parse, link, and expose a valid reflection model for every pass. Location/type mismatches and syntax errors fail the resource bake before runtime. Source/Tools/EffectBaker.cpp
effect-format.baking.metadata Per-pass metadata Each pass emits an info artifact with [EffectInfo] native bindings and [EffectInfoSdl] per-stage dense slots and resource counts. Runtime backends consume reflection results without running glslang. Source/Tools/EffectBaker.cpp
effect-format.baking.native-flavors Native and cross-compiled flavors Each stage emits native Vulkan SPIR-V, desktop GLSL 330, GLSL ES 300, HLSL Shader Model 4.0, and Metal source for macOS and iOS. One source effect supports the active renderer backends without project-side shader forks. Source/Tools/EffectBaker.cpp
effect-format.baking.sdl-remap SDL_GPU descriptor remap The baker copies native SPIR-V, rewrites descriptor sets and bindings to SDL_GPU’s per-stage convention, and emits the result as spv_sdl. Metal source is compiled from the remapped module. Native Vulkan bindings remain untouched while SDL_GPU gets dense stage-local slots. Source/Tools/EffectBaker.cpp
effect-format.baking.source-copy Baked source copy The original .fofx source is written to the baked resource set after all pass artifacts. RenderEffect reparses [Effect] state at runtime; the source file is part of the runtime artifact set. Source/Tools/EffectBaker.cpp, Source/Frontend/Rendering.cpp
effect-format.baking.incremental Incremental output set The bake checker tracks the source copy, pass metadata, and every stage/flavor artifact for every declared pass. A missing or stale flavor must make the effect eligible for rebaking. Source/Tools/EffectBaker.cpp
Start typing to search.