2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-03-15 17:33:03 +00:00

chore: add logic for computing precompiled index on material pass

This commit is contained in:
Jan Laupetin
2026-03-02 22:07:55 +00:00
parent 925e51cb10
commit 1611c222cc
10 changed files with 291 additions and 12 deletions

View File

@@ -193,7 +193,8 @@ namespace
"passthrough",
ConvertToCommonShader(pass.vertexShader),
ConvertToCommonShader(pass.pixelShader),
ConvertToCommonVertexDeclaration(pass.vertexDecl));
ConvertToCommonVertexDeclaration(pass.vertexDecl),
std::string());
if (pass.args)
{

View File

@@ -232,19 +232,28 @@ namespace
return result;
}
techset::CommonTechnique ConvertToCommonTechnique(const MaterialTechnique& technique)
techset::CommonTechnique ConvertToCommonTechnique(const MaterialTechnique& technique, const bool debug)
{
techset::CommonTechnique commonTechnique(technique.name ? technique.name : std::string(), technique.flags);
for (auto passIndex = 0u; passIndex < technique.passCount; passIndex++)
{
const auto& pass = technique.passArray[passIndex];
std::string comment;
if (debug)
{
comment = std::format(
"MaterialType: {}; PrecompiledIndex: {}", static_cast<unsigned>(pass.materialType), static_cast<unsigned>(pass.precompiledIndex));
}
techset::CommonPass commonPass(pass.customSamplerFlags,
// No clue what the actual state map was
"passthrough",
ConvertToCommonShader(pass.vertexShader),
ConvertToCommonShader(pass.pixelShader),
ConvertToCommonVertexDeclaration(pass.vertexDecl));
ConvertToCommonVertexDeclaration(pass.vertexDecl),
std::move(comment));
if (pass.args)
{
@@ -268,7 +277,7 @@ namespace
{
if (technique && techniqueState->ShouldDumpTechnique(technique))
{
const auto commonTechnique = ConvertToCommonTechnique(*technique);
const auto commonTechnique = ConvertToCommonTechnique(*technique, debug);
techset::DumpCommonTechnique(
context, commonTechnique, techset::DxVersion::DX11, commonCodeSourceInfos, commonRoutingInfos, *materialConstantState, debug);

View File

@@ -67,6 +67,12 @@ namespace
m_stream << std::format("// CUSTOM SAMPLER FLAGS: 0x{:x}\n", mask);
}
}
if (!pass.m_comment.empty())
{
Indent();
m_stream << std::format("// {}\n", pass.m_comment);
}
}
DumpStateMap();