Fix shader unction visibility parsing and add USE_EDITOR define to material shaders
This commit is contained in:
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user