resources: remove legacy shader authoring path
This commit is contained in:
@@ -103,7 +103,7 @@ bool TryExtractProgramBlocks(
|
||||
auto fail = [&outError](const std::string& message, size_t humanLine) -> bool {
|
||||
if (outError != nullptr) {
|
||||
*outError = Containers::String(
|
||||
("Unity-style shader parse error at line " + std::to_string(humanLine) + ": " + message).c_str());
|
||||
("shader authoring parse error at line " + std::to_string(humanLine) + ": " + message).c_str());
|
||||
}
|
||||
return false;
|
||||
};
|
||||
@@ -148,40 +148,6 @@ bool TryExtractProgramBlocks(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ContainsBackendPragma(const std::vector<std::string>& lines) {
|
||||
for (const std::string& line : lines) {
|
||||
if (line.rfind("#pragma backend", 0) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ContainsResourcesBlock(const std::vector<std::string>& lines) {
|
||||
for (const std::string& line : lines) {
|
||||
if (line == "Resources" || StartsWithKeyword(line, "Resources")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ContainsSingleSourceAuthoringConstructs(const std::vector<std::string>& lines) {
|
||||
for (const std::string& line : lines) {
|
||||
if (line == "HLSLINCLUDE" || line == "CGINCLUDE") {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (line.rfind("#pragma target", 0) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t FindMatchingDelimiter(
|
||||
const std::string& text,
|
||||
size_t openPos,
|
||||
@@ -544,54 +510,6 @@ bool TryParseAuthoringPropertyLine(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TryParseAuthoringResourceLine(
|
||||
const std::string& line,
|
||||
ShaderResourceBindingDesc& outBinding) {
|
||||
outBinding = {};
|
||||
|
||||
const size_t openParen = line.find('(');
|
||||
if (openParen == std::string::npos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t closeParen = FindMatchingDelimiter(line, openParen, '(', ')');
|
||||
if (closeParen == std::string::npos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
outBinding.name = Containers::String(TrimCopy(line.substr(0, openParen)).c_str());
|
||||
if (outBinding.name.Empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::string> parts;
|
||||
if (!SplitCommaSeparatedAuthoring(line.substr(openParen + 1, closeParen - openParen - 1), parts) ||
|
||||
parts.size() != 3u) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TryParseShaderResourceType(parts[0].c_str(), outBinding.type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
outBinding.set = static_cast<Core::uint32>(std::stoul(parts[1]));
|
||||
outBinding.binding = static_cast<Core::uint32>(std::stoul(parts[2]));
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t attributePos = FindFirstTopLevelChar(line.substr(closeParen + 1), '[');
|
||||
if (attributePos != std::string::npos) {
|
||||
const std::string attributesText = line.substr(closeParen + 1 + attributePos);
|
||||
if (!TryParseSemanticAttributes(attributesText, outBinding.semantic)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Resources
|
||||
} // namespace XCEngine
|
||||
|
||||
Reference in New Issue
Block a user