Hi, guys, I am a newbie. Does anyone know what these identifiers “@” mean? For example,
// Get material properties function (for pixel shader)
Material GetMaterialPS(MaterialInput input)
{
“@4”
}
Thanks a lot!
Hi, guys, I am a newbie. Does anyone know what these identifiers “@” mean? For example,
// Get material properties function (for pixel shader)
Material GetMaterialPS(MaterialInput input)
{
“@4”
}
Thanks a lot!
@3
#include “./Flax/Common.hlsl”
#include “./Flax/MaterialCommon.hlsl”
#include “./Flax/GBufferCommon.hlsl”
@7
This symbol confuses me so much!
Those are special locations for Material generator tool to inject code0generated source of the shader from the Material Graph. FlaxEngine/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.cpp at master · FlaxEngine/FlaxEngine · GitHub
Thank you! but I still have a question, when is MaterialGenerator::Generate() called? If you want to inject shader code, it should be before ShadersCompilation::Compile()—>Device create the real shader module, otherwise the shader will not compile.
Material shaders are generated during Material::load
and compiled via ShaderAssetBase::LoadShaderCache
. Additionally, shaders compilation can happen during game cooking (ProcessShaderBase
in CookAssetsStep.cpp
).
Thank you so much! I’ll try to track and debug it tomorrow.