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

Effect Shader Resources

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

Compile-time limits

Stable ID CMake option Runtime name Default Meaning Source
effect-format.limit.script-values FO_EFFECT_SCRIPT_VALUES EFFECT_SCRIPT_VALUES 16 Number of float slots in ScriptValueBuf. The value must be positive and divisible by four because the GLSL declaration is an array of vec4 values and the native buffer is 16-byte aligned. Source/Frontend/Rendering.h, BuildTools/cmake/ProjectInterface.json
effect-format.limit.passes FO_EFFECT_MAX_PASSES EFFECT_MAX_PASSES 6 Maximum number of render passes in one effect and the exclusive storage bound for per-pass state and backend objects. Source/Frontend/Rendering.h, Source/Frontend/Rendering.cpp
effect-format.limit.model-textures FO_MODEL_MAX_TEXTURES MODEL_MAX_TEXTURES 8 Number of ModelTexN samplers and ModelTexBuf entries available to 3D effects. Source/Frontend/Rendering.h, Source/Tools/EffectBaker.cpp
effect-format.limit.model-bones FO_MODEL_MAX_BONES MODEL_MAX_BONES 54 Number of WorldMatrices entries exposed to 3D effects through ModelBuf and the MAX_BONES shader define. Source/Frontend/Rendering.h, Source/Tools/EffectBaker.cpp

Shader resources and inputs

Stable ID Resource Requirement Why Source
effect-format.resource.vertex-2d Vertex2D input layout ImGui, QuadSprite, and Primitive effects consume locations 0..3 from Vertex2D: vec3 position, normalized color, vec2 texture coordinate, and vec2 egg/auxiliary data. The non-model usages share one native vertex structure even when a shader ignores some inputs. Source/Frontend/Rendering.h, Resources/Core/Effects/2D_Default.fofx
effect-format.resource.vertex-model Vertex3D input layout Model effects consume locations 0..8: position, normal, primary UV, base UV, tangent, bitangent, blend weights, blend indices, and color. All model shaders must match the fixed Vertex3D layout configured by every active backend. Source/Frontend/Rendering.h, Resources/Core/Effects/3D_Skinned.fofx
effect-format.resource.native-descriptor-sets Native Vulkan descriptor convention Author native shader resources with uniform buffers in descriptor set 0 and combined image samplers in descriptor set 1. The native SPIR-V is consumed unchanged by Rendering-Vulkan and is the source for GLSL, GLSL ES, and HLSL cross-compilation. Source/Tools/EffectBaker.cpp, Resources/Core/Effects/2D_Default.fofx
effect-format.resource.explicit-bindings Explicit bindings Every live sampler and uniform block must declare an explicit binding. Binding numbers must be unique within each shader stage and resource class. SDL_GPU slot assignment sorts authored bindings and remaps them to dense per-stage slots. Source/Tools/EffectBaker.cpp
effect-format.resource.samplers Renderer-provided samplers The runtime has producers for MainTex, IndoorMaskTex, and BackgroundTex, plus ModelTex0 through ModelTexN-1 in 3D builds. BackgroundTex is a caller-supplied scene snapshot for refraction. Other reflected sampler names are not populated by RenderEffect. A shader may compile with another sampler name but receives no Engine-owned texture binding. Source/Tools/EffectBaker.cpp, Source/Frontend/Rendering.h
effect-format.resource.general-buffers General uniform buffers Recognized general buffers are ProjBuf, MainTexBuf, EggBuf, SpriteBorderBuf, ParticleSamplingBuf, TimeBuf, RandomValueBuf, ScriptValueBuf, and CameraBuf. ParticleSamplingBuf is caller-defined per draw for particle texture sampling and distortion controls. Declarations must match the native std140-compatible layouts exactly. EffectBaker validates reflected byte sizes against RenderEffect buffer structures. Source/Tools/EffectBaker.cpp, Source/Frontend/Rendering.h
effect-format.resource.model-buffers 3D uniform buffers Recognized model buffers are ModelBuf, ModelTexBuf, and ModelAnimBuf, with MAX_BONES and MAX_TEXTURES supplied by the baker prelude. These layouts carry skinning, lighting, texture-atlas, and animation timing data for model effects. Source/Tools/EffectBaker.cpp, Source/Frontend/Rendering.h
effect-format.resource.script-values ScriptValueBuf Declare ‘vec4 ScriptValue[MAX_SCRIPT_VALUES / 4]’ inside ScriptValueBuf. The flat script-facing index range is 0..EFFECT_SCRIPT_VALUES-1. The baker supplies MAX_SCRIPT_VALUES and the client API writes float ranges into the same native buffer. Source/Tools/EffectBaker.cpp, Source/Frontend/Rendering.h
effect-format.resource.time-random Per-frame buffers TimeBuf exposes FrameTime.x and GameTime.x as session-relative seconds wrapped at 8192; RandomValueBuf exposes four independent [0,1] values refreshed each frame. These buffers are updated per loaded effect only when reflection reports that the effect needs them. Source/Client/EffectManager.cpp, Source/Frontend/Rendering.h
effect-format.resource.camera CameraBuf affine bases CameraBuf contains MapAnchorScreenPos and ChunkScreenAnchor. Shaders evaluate either basis as ‘.xy + TexCoord * .zw’ for world-anchored or screen-anchored coordinates. The scale terms preserve continuity across padded/chunked render targets and zoom. Source/Frontend/Rendering.h
effect-format.resource.unsupported Unsupported shader resources Unknown uniform blocks, storage buffers, and storage images are rejected. Dead declared descriptor resources are rejected during SDL SPIR-V patching. The renderer binds only its fixed buffer vocabulary and sampled textures. Source/Tools/EffectBaker.cpp
effect-format.resource.sdl-limits SDL_GPU per-stage limits Each shader stage may use at most 16 samplers and 4 uniform buffers. Slots become dense independently for vertex samplers, vertex UBOs, fragment samplers, and fragment UBOs. SDL_CreateGPUShader requires per-stage counts and the backend descriptor convention differs from native Vulkan. Source/Tools/EffectBaker.cpp
Start typing to search.