Fix shader unction visibility parsing and add USE_EDITOR define to material shaders

This commit is contained in:
Wojtek Figat
2021-10-07 11:43:11 +02:00
parent 690e3ee3ca
commit bdd2dbb719
2 changed files with 9 additions and 4 deletions

View File

@@ -273,7 +273,12 @@ bool ShaderAssetBase::LoadShaderCache(ShaderCacheResult& result)
#else
#error "Unknown platform."
#endif
platformDefine.Definition = nullptr;
platformDefine.Definition = "1";
#if USE_EDITOR
auto& editorDefine = options.Macros.AddOne();
editorDefine.Name = "USE_EDITOR";
editorDefine.Definition = "1";
#endif
InitCompilationOptions(options);
if (ShadersCompilation::Compile(options))
{

View File

@@ -367,14 +367,14 @@ namespace ShaderProcessing
{
// Visible shader
}
else if (token == "false" || token == "0")
else if (token == "false" || token == "0" || token.Length == 0)
{
// Hidden shader
current.Flags = ShaderFlags::Hidden;
}
else
{
parser->OnError(TEXT("Invalid shader function \'isVisible\' option value."));
parser->OnError(String::Format(TEXT("Invalid shader function \'isVisible\' option value \'{0}\'."), String(token.ToString())));
return;
}
text.ReadToken(&token);
@@ -415,7 +415,7 @@ namespace ShaderProcessing
void OnParseAfter(IShaderParser* parser, Reader& text) override
{
auto& current = ShaderMetaReaderType::_current;
// Validate amount of permutations
if (current.Permutations.Count() > SHADER_PERMUTATIONS_MAX_COUNT)
{