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

@@ -4,7 +4,7 @@ namespace XCEngine {
namespace Resources {
namespace Internal {
MaterialRenderState BuildUnityDefaultFixedFunctionState() {
MaterialRenderState BuildDefaultAuthoringFixedFunctionState() {
MaterialRenderState state = {};
state.blendEnable = false;
state.srcBlend = MaterialBlendFactor::One;
@@ -26,11 +26,11 @@ void EnsureAuthoringFixedFunctionStateInitialized(
MaterialRenderState& fixedFunctionState) {
if (!hasFixedFunctionState) {
hasFixedFunctionState = true;
fixedFunctionState = BuildUnityDefaultFixedFunctionState();
fixedFunctionState = BuildDefaultAuthoringFixedFunctionState();
}
}
bool TryParseUnityStyleBoolDirectiveToken(const std::string& token, bool& outValue) {
bool TryParseAuthoringBoolDirectiveToken(const std::string& token, bool& outValue) {
const Containers::String normalized = Containers::String(token.c_str()).Trim().ToLower();
if (normalized == "on") {
outValue = true;
@@ -43,7 +43,7 @@ bool TryParseUnityStyleBoolDirectiveToken(const std::string& token, bool& outVal
return false;
}
bool TryParseUnityStyleCullMode(const std::string& token, MaterialCullMode& outMode) {
bool TryParseAuthoringCullMode(const std::string& token, MaterialCullMode& outMode) {
const Containers::String normalized = Containers::String(token.c_str()).Trim().ToLower();
if (normalized == "back") {
outMode = MaterialCullMode::Back;
@@ -60,7 +60,7 @@ bool TryParseUnityStyleCullMode(const std::string& token, MaterialCullMode& outM
return false;
}
bool TryParseUnityStyleComparisonFunc(const std::string& token, MaterialComparisonFunc& outFunc) {
bool TryParseAuthoringComparisonFunc(const std::string& token, MaterialComparisonFunc& outFunc) {
const Containers::String normalized = Containers::String(token.c_str()).Trim().ToLower();
if (normalized == "never") {
outFunc = MaterialComparisonFunc::Never;
@@ -97,7 +97,7 @@ bool TryParseUnityStyleComparisonFunc(const std::string& token, MaterialComparis
return false;
}
bool TryParseUnityStyleBlendFactor(const std::string& token, MaterialBlendFactor& outFactor) {
bool TryParseAuthoringBlendFactor(const std::string& token, MaterialBlendFactor& outFactor) {
const Containers::String normalized = Containers::String(token.c_str()).Trim().ToLower();
if (normalized == "zero") {
outFactor = MaterialBlendFactor::Zero;
@@ -146,7 +146,7 @@ bool TryParseUnityStyleBlendFactor(const std::string& token, MaterialBlendFactor
return false;
}
bool TryParseUnityStyleColorMask(const std::string& token, Core::uint8& outMask) {
bool TryParseAuthoringColorMask(const std::string& token, Core::uint8& outMask) {
const Containers::String normalized = Containers::String(token.c_str()).Trim().ToUpper();
if (normalized == "0") {
outMask = 0u;
@@ -177,7 +177,7 @@ bool TryParseUnityStyleColorMask(const std::string& token, Core::uint8& outMask)
return true;
}
bool TryParseUnityStyleBlendDirective(
bool TryParseAuthoringBlendDirective(
const std::vector<std::string>& tokens,
MaterialRenderState& outState) {
std::vector<std::string> normalizedTokens;
@@ -204,7 +204,7 @@ bool TryParseUnityStyleBlendDirective(
if (normalizedTokens.size() == 2u) {
bool enabled = false;
if (!TryParseUnityStyleBoolDirectiveToken(normalizedTokens[1], enabled)) {
if (!TryParseAuthoringBoolDirectiveToken(normalizedTokens[1], enabled)) {
return false;
}
@@ -220,8 +220,8 @@ bool TryParseUnityStyleBlendDirective(
MaterialBlendFactor srcBlend = MaterialBlendFactor::One;
MaterialBlendFactor dstBlend = MaterialBlendFactor::Zero;
if (!TryParseUnityStyleBlendFactor(normalizedTokens[1], srcBlend) ||
!TryParseUnityStyleBlendFactor(normalizedTokens[2], dstBlend)) {
if (!TryParseAuthoringBlendFactor(normalizedTokens[1], srcBlend) ||
!TryParseAuthoringBlendFactor(normalizedTokens[2], dstBlend)) {
return false;
}
@@ -230,8 +230,8 @@ bool TryParseUnityStyleBlendDirective(
outState.dstBlend = dstBlend;
if (normalizedTokens.size() == 5u) {
if (!TryParseUnityStyleBlendFactor(normalizedTokens[3], outState.srcBlendAlpha) ||
!TryParseUnityStyleBlendFactor(normalizedTokens[4], outState.dstBlendAlpha)) {
if (!TryParseAuthoringBlendFactor(normalizedTokens[3], outState.srcBlendAlpha) ||
!TryParseAuthoringBlendFactor(normalizedTokens[4], outState.dstBlendAlpha)) {
return false;
}
} else {