mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-03-05 12:33:02 +00:00
chore: enable techset debugging on dumper creation level
This commit is contained in:
@@ -18,7 +18,13 @@ void ObjWriter::RegisterAssetDumpers(AssetDumpingContext& context)
|
||||
// REGISTER_DUMPER(AssetDumperXAnimParts, m_xanim_parts)
|
||||
RegisterAssetDumper(std::make_unique<xmodel::DumperT5>());
|
||||
RegisterAssetDumper(std::make_unique<material::JsonDumperT5>());
|
||||
RegisterAssetDumper(std::make_unique<techset::DumperT5>());
|
||||
RegisterAssetDumper(std::make_unique<techset::DumperT5>(
|
||||
#ifdef TECHSET_DEBUG
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
));
|
||||
RegisterAssetDumper(std::make_unique<image::DumperT5>());
|
||||
// REGISTER_DUMPER(AssetDumperSndBank, m_sound_bank)
|
||||
// REGISTER_DUMPER(AssetDumperSndPatch, m_sound_patch)
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace
|
||||
return commonTechnique;
|
||||
}
|
||||
|
||||
void DumpTechniques(AssetDumpingContext& context, const MaterialTechniqueSet& techset)
|
||||
void DumpTechniques(AssetDumpingContext& context, const MaterialTechniqueSet& techset, const bool debug)
|
||||
{
|
||||
auto* techniqueState = context.GetZoneAssetDumperState<techset::TechniqueDumpingZoneState>();
|
||||
const auto* materialConstantState = context.GetZoneAssetDumperState<MaterialConstantZoneState>();
|
||||
@@ -220,7 +220,7 @@ namespace
|
||||
const auto commonTechnique = ConvertToCommonTechnique(*technique);
|
||||
|
||||
techset::DumpCommonTechnique(
|
||||
context, commonTechnique, techset::DxVersion::DX9, commonCodeSourceInfos, commonRoutingInfos, *materialConstantState);
|
||||
context, commonTechnique, techset::DxVersion::DX9, commonCodeSourceInfos, commonRoutingInfos, *materialConstantState, debug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -250,6 +250,11 @@ namespace
|
||||
|
||||
namespace techset
|
||||
{
|
||||
DumperT5::DumperT5(const bool debug)
|
||||
: m_debug(debug)
|
||||
{
|
||||
}
|
||||
|
||||
void DumperT5::Dump(AssetDumpingContext& context)
|
||||
{
|
||||
context.GetZoneAssetDumperState<MaterialConstantZoneState>()->EnsureInitialized();
|
||||
@@ -260,7 +265,7 @@ namespace techset
|
||||
{
|
||||
const auto* techniqueSet = asset.Asset();
|
||||
DumpTechset(context, *techniqueSet);
|
||||
DumpTechniques(context, *techniqueSet);
|
||||
DumpTechniques(context, *techniqueSet, m_debug);
|
||||
DumpShaders(context, *techniqueSet);
|
||||
}
|
||||
} // namespace techset
|
||||
|
||||
@@ -8,9 +8,14 @@ namespace techset
|
||||
class DumperT5 final : public AbstractAssetDumper<T5::AssetTechniqueSet>
|
||||
{
|
||||
public:
|
||||
explicit DumperT5(bool debug);
|
||||
|
||||
void Dump(AssetDumpingContext& context) override;
|
||||
|
||||
protected:
|
||||
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T5::AssetTechniqueSet::Type>& asset) override;
|
||||
|
||||
private:
|
||||
bool m_debug;
|
||||
};
|
||||
} // namespace techset
|
||||
|
||||
@@ -35,7 +35,13 @@ void ObjWriter::RegisterAssetDumpers(AssetDumpingContext& context)
|
||||
// REGISTER_DUMPER(AssetDumperXAnimParts, m_xanim_parts)
|
||||
RegisterAssetDumper(std::make_unique<xmodel::DumperT6>());
|
||||
RegisterAssetDumper(std::make_unique<material::JsonDumperT6>());
|
||||
RegisterAssetDumper(std::make_unique<techset::DumperT6>());
|
||||
RegisterAssetDumper(std::make_unique<techset::DumperT6>(
|
||||
#ifdef TECHSET_DEBUG
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
));
|
||||
RegisterAssetDumper(std::make_unique<image::DumperT6>());
|
||||
RegisterAssetDumper(std::make_unique<sound::SndBankDumperT6>());
|
||||
// REGISTER_DUMPER(AssetDumperSndPatch, m_sound_patch)
|
||||
|
||||
@@ -260,7 +260,7 @@ namespace
|
||||
return commonTechnique;
|
||||
}
|
||||
|
||||
void DumpTechniques(AssetDumpingContext& context, const MaterialTechniqueSet& techset)
|
||||
void DumpTechniques(AssetDumpingContext& context, const MaterialTechniqueSet& techset, const bool debug)
|
||||
{
|
||||
auto* techniqueState = context.GetZoneAssetDumperState<techset::TechniqueDumpingZoneState>();
|
||||
const auto* materialConstantState = context.GetZoneAssetDumperState<MaterialConstantZoneState>();
|
||||
@@ -271,7 +271,7 @@ namespace
|
||||
const auto commonTechnique = ConvertToCommonTechnique(*technique);
|
||||
|
||||
techset::DumpCommonTechnique(
|
||||
context, commonTechnique, techset::DxVersion::DX11, commonCodeSourceInfos, commonRoutingInfos, *materialConstantState);
|
||||
context, commonTechnique, techset::DxVersion::DX11, commonCodeSourceInfos, commonRoutingInfos, *materialConstantState, debug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -300,6 +300,11 @@ namespace
|
||||
|
||||
namespace techset
|
||||
{
|
||||
DumperT6::DumperT6(const bool debug)
|
||||
: m_debug(debug)
|
||||
{
|
||||
}
|
||||
|
||||
void DumperT6::Dump(AssetDumpingContext& context)
|
||||
{
|
||||
context.GetZoneAssetDumperState<MaterialConstantZoneState>()->EnsureInitialized();
|
||||
@@ -310,7 +315,7 @@ namespace techset
|
||||
{
|
||||
const auto* techniqueSet = asset.Asset();
|
||||
DumpTechset(context, *techniqueSet);
|
||||
DumpTechniques(context, *techniqueSet);
|
||||
DumpTechniques(context, *techniqueSet, m_debug);
|
||||
DumpShaders(context, *techniqueSet);
|
||||
}
|
||||
} // namespace techset
|
||||
|
||||
@@ -8,9 +8,14 @@ namespace techset
|
||||
class DumperT6 final : public AbstractAssetDumper<T6::AssetTechniqueSet>
|
||||
{
|
||||
public:
|
||||
explicit DumperT6(bool debug);
|
||||
|
||||
void Dump(AssetDumpingContext& context) override;
|
||||
|
||||
protected:
|
||||
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T6::AssetTechniqueSet::Type>& asset) override;
|
||||
|
||||
private:
|
||||
bool m_debug;
|
||||
};
|
||||
} // namespace techset
|
||||
|
||||
@@ -20,8 +20,10 @@ namespace
|
||||
const DxVersion dxVersion,
|
||||
const CommonCodeSourceInfos& codeSourceInfos,
|
||||
const CommonStreamRoutingInfos& routingInfos,
|
||||
const AbstractMaterialConstantZoneState& constantZoneState)
|
||||
const AbstractMaterialConstantZoneState& constantZoneState,
|
||||
const bool debug)
|
||||
: AbstractTextDumper(stream),
|
||||
m_debug(debug),
|
||||
m_dx_version(dxVersion),
|
||||
m_code_source_infos(codeSourceInfos),
|
||||
m_routing_infos(routingInfos),
|
||||
@@ -31,8 +33,7 @@ namespace
|
||||
|
||||
void DumpTechnique(const CommonTechnique& technique)
|
||||
{
|
||||
#ifdef TECHSET_DEBUG
|
||||
if (technique.m_flags)
|
||||
if (m_debug && technique.m_flags)
|
||||
{
|
||||
for (auto i = 0u; i < sizeof(CommonTechnique::m_flags) * 8u; i++)
|
||||
{
|
||||
@@ -44,7 +45,6 @@ namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (const auto& pass : technique.m_passes)
|
||||
DumpPass(technique, pass);
|
||||
@@ -56,17 +56,18 @@ namespace
|
||||
m_stream << "{\n";
|
||||
IncIndent();
|
||||
|
||||
#ifdef TECHSET_DEBUG
|
||||
for (auto i = 0u; i < sizeof(CommonPass::m_sampler_flags) * 8u; i++)
|
||||
if (m_debug)
|
||||
{
|
||||
const auto mask = 1ull << i;
|
||||
if (pass.m_sampler_flags & mask)
|
||||
for (auto i = 0u; i < sizeof(CommonPass::m_sampler_flags) * 8u; i++)
|
||||
{
|
||||
Indent();
|
||||
m_stream << std::format("// CUSTOM SAMPLER FLAGS: 0x{:x}\n", mask);
|
||||
const auto mask = 1ull << i;
|
||||
if (pass.m_sampler_flags & mask)
|
||||
{
|
||||
Indent();
|
||||
m_stream << std::format("// CUSTOM SAMPLER FLAGS: 0x{:x}\n", mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
DumpStateMap();
|
||||
DumpShader(technique, pass, pass.m_vertex_shader, CommonTechniqueShaderType::VERTEX, m_dx_version);
|
||||
@@ -337,12 +338,10 @@ namespace
|
||||
Indent();
|
||||
m_stream << std::format("{} = constant.{};\n", codeDestAccessor, codeAccessor);
|
||||
}
|
||||
else
|
||||
else if (m_debug)
|
||||
{
|
||||
#ifdef TECHSET_DEBUG
|
||||
Indent();
|
||||
m_stream << std::format("// Omitted due to matching accessors: {} = constant.{};\n", codeDestAccessor, codeAccessor);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -363,12 +362,10 @@ namespace
|
||||
Indent();
|
||||
m_stream << std::format("{} = sampler.{};\n", codeDestAccessor, samplerSourceInfo->accessor);
|
||||
}
|
||||
else
|
||||
else if (m_debug)
|
||||
{
|
||||
#ifdef TECHSET_DEBUG
|
||||
Indent();
|
||||
m_stream << std::format("// Omitted due to matching accessors: {} = sampler.{};\n", codeDestAccessor, samplerSourceInfo->accessor);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -429,6 +426,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
bool m_debug;
|
||||
DxVersion m_dx_version;
|
||||
const CommonCodeSourceInfos& m_code_source_infos;
|
||||
const CommonStreamRoutingInfos& m_routing_infos;
|
||||
@@ -443,12 +441,13 @@ namespace techset
|
||||
const DxVersion dxVersion,
|
||||
const CommonCodeSourceInfos& codeSourceInfos,
|
||||
const CommonStreamRoutingInfos& routingInfos,
|
||||
const AbstractMaterialConstantZoneState& constantZoneState)
|
||||
const AbstractMaterialConstantZoneState& constantZoneState,
|
||||
const bool debug)
|
||||
{
|
||||
const auto techniqueFile = context.OpenAssetFile(GetFileNameForTechniqueName(technique.m_name));
|
||||
if (techniqueFile)
|
||||
{
|
||||
TechniqueFileWriter writer(*techniqueFile, dxVersion, codeSourceInfos, routingInfos, constantZoneState);
|
||||
TechniqueFileWriter writer(*techniqueFile, dxVersion, codeSourceInfos, routingInfos, constantZoneState, debug);
|
||||
writer.DumpTechnique(technique);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,5 +11,6 @@ namespace techset
|
||||
DxVersion dxVersion,
|
||||
const CommonCodeSourceInfos& codeSourceInfos,
|
||||
const CommonStreamRoutingInfos& routingInfos,
|
||||
const AbstractMaterialConstantZoneState& constantZoneState);
|
||||
const AbstractMaterialConstantZoneState& constantZoneState,
|
||||
bool debug);
|
||||
} // namespace techset
|
||||
|
||||
Reference in New Issue
Block a user