mirror of
https://github.com/Eragon-Brisingr/UShaderLab.git
synced 2026-09-15 14:54:36 +00:00
Support Legacy shader mode
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "Serialization/JsonReader.h"
|
||||
#include "Serialization/JsonSerializer.h"
|
||||
#include "Serialization/JsonWriter.h"
|
||||
#include "RenderUtils.h" // Substrate::IsSubstrateEnabled()
|
||||
#include "ShaderCore.h"
|
||||
#include "ShaderLabIntrinsicRegistry.h"
|
||||
|
||||
@@ -405,6 +406,20 @@ namespace ShaderLabIDEPrepare_Private
|
||||
bChanged = true;
|
||||
}
|
||||
|
||||
// SHADERLAB_SUBSTRATE picks the surface-struct parameterization (Substrate Slab fields vs legacy
|
||||
// Metallic/Roughness) the IDE checks against. It mirrors the project's r.Substrate so authoring on
|
||||
// the legacy (r.Substrate=0) branch sees the legacy FShaderLabSurface (S.BaseColor/Metallic/...) and
|
||||
// does not red-underline it as "no member". The real compiler derives this from the engine's own
|
||||
// SUBSTRATE_ENABLED; this only affects the editor's shader-validator.
|
||||
const TCHAR* SubstrateValue = Substrate::IsSubstrateEnabled() ? TEXT("1") : TEXT("0");
|
||||
FString SubstrateDefine;
|
||||
if (!Defines->TryGetStringField(TEXT("SHADERLAB_SUBSTRATE"), SubstrateDefine) || SubstrateDefine != SubstrateValue)
|
||||
{
|
||||
Defines->SetStringField(TEXT("SHADERLAB_SUBSTRATE"), SubstrateValue);
|
||||
Settings->SetObjectField(TEXT("shader-validator.defines"), Defines);
|
||||
bChanged = true;
|
||||
}
|
||||
|
||||
if (!bChanged)
|
||||
{
|
||||
UE_LOG(LogShaderLabIDE, Log, TEXT(" unchanged: %s"), *SettingsPath);
|
||||
|
||||
Reference in New Issue
Block a user