VL.StandardLibs
VL.StandardLibs copied to clipboard
Shader source loading
Current state
Defined by Stride:
- Every shader can only exist once at a runtime session
- The shader is the name (called class name ins stride) and the file name must be the same as the shader name. the folder on the disc is not added to the Id
- the sdsl source string is added to the asset db by the asset compiler on build
- platform-specific shaders (HLSL, etc.) are always compiled and cached in the /log folder from the sdsl files when a compiled application is started, (vvvv.exe by devvvvs, vvvv.exe by user or user exported exe)
- On windows stride tries to load the original sdsl file from what is stored in /path in the db, if that fails the sdsl source is loaded from the db: ShaderSourceManager.cs#L140
Defined by VL.Stride:
- we add additional shader files via factories with new file providers: EffectShaderNodes.cs#L55
- When a shader source is requested, we first try to find the file path in:
- these new file providers
- then in the /path field in the new file provider
- then in the original db file provider
- then in the /path field of the original db file provider
- then locally in the /packs/nugets folder next to the vvvv.exe
- lastly the source is read from the db code is in: EffectUtils.cs#L58
Cases we have
Stride shaders
- edited at stride dev design time
- compiled into stride nugets
- loaded by stride source manager
- mostly used as base shaders and materials
Devvvv shaders
- edited at devvvv and contributor design time
- compiled into VL.Stride nuget
User shaders
- edited at vvvv user design time
- compiled into the exported app
- added by factories, additional file providers
Exported app shaders
- final, no changes should be possible
Node Factories
- look at all shader names for suffix and then parses shader attributes to build TextureFX, DrawFX, ComputeFX and ShaderFX nodes
- watch for changes and try to rebuild node definitions
related: vvvv/VL.StandardLibs#166 and issue with Pin order sometimes wrong and SetValue calls the wrong pin see forum