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:
@@ -193,7 +193,8 @@ namespace
|
||||
"passthrough",
|
||||
ConvertToCommonShader(pass.vertexShader),
|
||||
ConvertToCommonShader(pass.pixelShader),
|
||||
ConvertToCommonVertexDeclaration(pass.vertexDecl));
|
||||
ConvertToCommonVertexDeclaration(pass.vertexDecl),
|
||||
std::string());
|
||||
|
||||
if (pass.args)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user