resources: remove legacy shader authoring path

This commit is contained in:
2026-04-07 14:13:26 +08:00
parent 1f140c4bab
commit 442565f176
18 changed files with 149 additions and 1063 deletions

View File

@@ -5,25 +5,10 @@
namespace XCEngine {
namespace Resources {
ShaderAuthoringStyle DetectShaderAuthoringStyle(const std::string& sourceText) {
bool LooksLikeShaderAuthoring(const std::string& sourceText) {
std::vector<std::string> lines;
Internal::SplitShaderAuthoringLines(sourceText, lines);
if (lines.empty() || !Internal::StartsWithKeyword(lines.front(), "Shader")) {
return ShaderAuthoringStyle::NotShaderAuthoring;
}
const bool hasBackendPragma = Internal::ContainsBackendPragma(lines);
const bool hasSingleSourceConstructs = Internal::ContainsSingleSourceAuthoringConstructs(lines);
if (hasBackendPragma && !hasSingleSourceConstructs) {
return ShaderAuthoringStyle::LegacyBackendSplit;
}
if (Internal::ContainsResourcesBlock(lines) || hasSingleSourceConstructs) {
return ShaderAuthoringStyle::UnityStyleSingleSource;
}
return ShaderAuthoringStyle::UnityStyleSingleSource;
return !lines.empty() && Internal::StartsWithKeyword(lines.front(), "Shader");
}
void AppendAuthoringSourceBlock(
@@ -40,8 +25,8 @@ void CollectQuotedIncludeDependencyPaths(
Internal::CollectQuotedIncludeDependencyPaths(sourcePath, sourceText, seenPaths, outDependencies);
}
Containers::String StripUnityStyleAuthoringPragmas(const Containers::String& sourceText) {
return Internal::StripUnityStyleAuthoringPragmas(sourceText);
Containers::String StripShaderAuthoringPragmas(const Containers::String& sourceText) {
return Internal::StripShaderAuthoringPragmas(sourceText);
}
std::vector<ShaderKeywordSet> BuildShaderKeywordVariantSets(
@@ -55,20 +40,12 @@ Containers::String BuildKeywordVariantSource(
return Internal::BuildKeywordVariantSource(baseSource, requiredKeywords);
}
bool ParseLegacyBackendSplitShaderAuthoring(
bool ParseShaderAuthoring(
const Containers::String& path,
const std::string& sourceText,
ShaderIR& outDesc,
Containers::String* outError) {
return Internal::ParseLegacyBackendSplitShaderAuthoring(path, sourceText, outDesc, outError);
}
bool ParseUnityStyleSingleSourceShaderAuthoring(
const Containers::String& path,
const std::string& sourceText,
ShaderIR& outDesc,
Containers::String* outError) {
return Internal::ParseUnityStyleSingleSourceShaderAuthoring(path, sourceText, outDesc, outError);
return Internal::ParseShaderAuthoring(path, sourceText, outDesc, outError);
}
} // namespace Resources