[idd] logging: suppress duplicate pipeline initialization

This commit is contained in:
Geoffrey McRae
2026-08-14 02:17:01 +10:00
parent 8c21f61e91
commit 91c501d602
6 changed files with 59 additions and 32 deletions

View File

@@ -137,8 +137,8 @@ bool CSwapChainProcessor::InitializePipeline()
DEBUG_INFO("Software render adapter: post-processing disabled"); DEBUG_INFO("Software render adapter: post-processing disabled");
bool initialized = true; bool initialized = true;
for (CPostProcessor& postProcessor : m_postProcessors) for (unsigned i = 0; i < ARRAYSIZE(m_postProcessors); ++i)
if (!postProcessor.Init(m_dx12Device, enableEffects)) if (!m_postProcessors[i].Init(m_dx12Device, enableEffects, i == 0))
{ {
initialized = false; initialized = false;
break; break;
@@ -153,12 +153,15 @@ bool CSwapChainProcessor::InitializePipeline()
break; break;
} }
if (initialized)
m_postProcessors[0].LogEffects();
if (!initialized) if (!initialized)
{ {
for (CPostProcessor& postProcessor : m_postProcessors) for (CPostProcessor& postProcessor : m_postProcessors)
{ {
postProcessor.Reset(); postProcessor.Reset();
if (!postProcessor.Init(m_dx12Device, false)) if (!postProcessor.Init(m_dx12Device, false, false))
DEBUG_ERROR("Failed to initialize post processor copy support"); DEBUG_ERROR("Failed to initialize post processor copy support");
} }
DEBUG_WARN( DEBUG_WARN(
@@ -680,17 +683,21 @@ bool CSwapChainProcessor::SwapChainNewFrame(ComPtr<IDXGIResource> acquiredBuffer
} }
bool configurationStable = false; bool configurationStable = false;
bool configured = false;
for (unsigned pass = 0; pass < 2 && !configurationStable; ++pass) for (unsigned pass = 0; pass < 2 && !configurationStable; ++pass)
{ {
for (unsigned i = 0; i < ARRAYSIZE(m_postProcessors); ++i) for (unsigned i = 0; i < ARRAYSIZE(m_postProcessors); ++i)
{ {
bool formatChanged = false; bool formatChanged = false;
if (!m_postProcessors[i].Configure(srcFormat, &formatChanged)) bool changed = false;
if (!m_postProcessors[i].Configure(
srcFormat, &formatChanged, &changed))
{ {
m_frameProcessor->SetFullDamage(); m_frameProcessor->SetFullDamage();
return false; return false;
} }
configured |= changed;
if (i == 0) if (i == 0)
postProcessFormatChanged |= formatChanged; postProcessFormatChanged |= formatChanged;
} }
@@ -711,6 +718,9 @@ bool CSwapChainProcessor::SwapChainNewFrame(ComPtr<IDXGIResource> acquiredBuffer
return false; return false;
} }
if (configured)
m_postProcessors[0].LogActiveEffects();
if (postProcessFormatChanged) if (postProcessFormatChanged)
m_frameProcessor->Invalidate(); m_frameProcessor->Invalidate();
else if (frameMetadataChanged) else if (frameMetadataChanged)

View File

@@ -123,7 +123,6 @@ bool CD3D12CommandSlot::Init(ID3D12Device3 * device,
return false; return false;
} }
DEBUG_INFO("Created CD3D12CommandSlot(%ls)", name);
return true; return true;
} }

View File

@@ -31,7 +31,7 @@
#include <utility> #include <utility>
bool CPostProcessor::Init(std::shared_ptr<CD3D12Device> dx12Device, bool CPostProcessor::Init(std::shared_ptr<CD3D12Device> dx12Device,
bool enableEffects) bool enableEffects, bool report)
{ {
m_dx12Device = dx12Device; m_dx12Device = dx12Device;
m_device = dx12Device->GetDevice(); m_device = dx12Device->GetDevice();
@@ -42,39 +42,48 @@ bool CPostProcessor::Init(std::shared_ptr<CD3D12Device> dx12Device,
std::unique_ptr<CColorTransformEffect> colorTransform(new CColorTransformEffect()); std::unique_ptr<CColorTransformEffect> colorTransform(new CColorTransformEffect());
if (colorTransform->Init(m_device)) if (colorTransform->Init(m_device))
{
DEBUG_INFO("Created post-processing effect: %s", colorTransform->GetName());
m_effects.push_back(std::move(colorTransform)); m_effects.push_back(std::move(colorTransform));
}
else else
{
DEBUG_ERROR("Failed to create post-processing effect: %s",
colorTransform->GetName());
return false; return false;
}
std::unique_ptr<CDownsampleEffect> downsample(new CDownsampleEffect()); std::unique_ptr<CDownsampleEffect> downsample(new CDownsampleEffect());
if (downsample->Init(m_device)) if (downsample->Init(m_device, report))
{
DEBUG_INFO("Created post-processing effect: %s", downsample->GetName());
m_effects.push_back(std::move(downsample)); m_effects.push_back(std::move(downsample));
}
std::unique_ptr<CHDR16to10Effect> hdr16to10(new CHDR16to10Effect()); std::unique_ptr<CHDR16to10Effect> hdr16to10(new CHDR16to10Effect());
if (hdr16to10->Init(m_device)) if (hdr16to10->Init(m_device))
{
DEBUG_INFO("Created post-processing effect: %s", hdr16to10->GetName());
m_effects.push_back(std::move(hdr16to10)); m_effects.push_back(std::move(hdr16to10));
}
else else
{
DEBUG_ERROR("Failed to create post-processing effect: %s",
hdr16to10->GetName());
return false; return false;
}
std::unique_ptr<CRGB24Effect> rgb24(new CRGB24Effect()); std::unique_ptr<CRGB24Effect> rgb24(new CRGB24Effect());
if (rgb24->Init(m_device)) if (rgb24->Init(m_device))
{
DEBUG_INFO("Created post-processing effect: %s", rgb24->GetName());
m_effects.push_back(std::move(rgb24)); m_effects.push_back(std::move(rgb24));
}
return true; return true;
} }
void CPostProcessor::LogEffects() const
{
for (const std::unique_ptr<CPostProcessEffect>& effect : m_effects)
DEBUG_INFO("Created post-processing effect: %s", effect->GetName());
}
void CPostProcessor::LogActiveEffects() const
{
for (const std::unique_ptr<CPostProcessEffect>& effect : m_effects)
if (effect->Enabled)
DEBUG_INFO("Post-processing effect active: %s", effect->GetName());
}
void CPostProcessor::Reset() void CPostProcessor::Reset()
{ {
m_effects.clear(); m_effects.clear();
@@ -151,10 +160,12 @@ bool CPostProcessor::RequiresFullDamage() const
} }
bool CPostProcessor::Configure(const D12FrameFormat& srcFormat, bool CPostProcessor::Configure(const D12FrameFormat& srcFormat,
bool * formatChanged) bool * formatChanged, bool * configured)
{ {
if (formatChanged) if (formatChanged)
*formatChanged = false; *formatChanged = false;
if (configured)
*configured = false;
if (!NeedsReconfigure(srcFormat)) if (!NeedsReconfigure(srcFormat))
{ {
@@ -165,6 +176,9 @@ bool CPostProcessor::Configure(const D12FrameFormat& srcFormat,
return true; return true;
} }
if (configured)
*configured = true;
D12FrameFormat oldDst = m_dstFormat; D12FrameFormat oldDst = m_dstFormat;
D12FrameFormat cur = srcFormat; D12FrameFormat cur = srcFormat;
CPostProcessEffect * outputEffect = nullptr; CPostProcessEffect * outputEffect = nullptr;
@@ -180,7 +194,6 @@ bool CPostProcessor::Configure(const D12FrameFormat& srcFormat,
effectsActive = true; effectsActive = true;
cur = dst; cur = dst;
outputEffect = effect.get(); outputEffect = effect.get();
DEBUG_INFO("Post-processing effect active: %s", effect->GetName());
break; break;
case PostProcessStatus::BYPASS_EFFECT: case PostProcessStatus::BYPASS_EFFECT:

View File

@@ -116,7 +116,9 @@ private:
public: public:
bool Init(std::shared_ptr<CD3D12Device> dx12Device, bool Init(std::shared_ptr<CD3D12Device> dx12Device,
bool enableEffects); bool enableEffects, bool report);
void LogEffects() const;
void LogActiveEffects() const;
void Reset(); void Reset();
bool HasSameEffectChain(const CPostProcessor& other) const; bool HasSameEffectChain(const CPostProcessor& other) const;
@@ -124,7 +126,8 @@ public:
void Update(const D12FrameFormat& srcFormat); void Update(const D12FrameFormat& srcFormat);
bool NeedsReconfigure(const D12FrameFormat& srcFormat) const; bool NeedsReconfigure(const D12FrameFormat& srcFormat) const;
bool RequiresFullDamage() const; bool RequiresFullDamage() const;
bool Configure(const D12FrameFormat& srcFormat, bool * formatChanged); bool Configure(const D12FrameFormat& srcFormat, bool * formatChanged,
bool * configured);
void AdjustFrameDamage(RECT dirtyRects[], unsigned * nbDirtyRects); void AdjustFrameDamage(RECT dirtyRects[], unsigned * nbDirtyRects);
ComPtr<ID3D12Resource> Run( ComPtr<ID3D12Resource> Run(
const ComPtr<ID3D12GraphicsCommandList>& commandList, const ComPtr<ID3D12GraphicsCommandList>& commandList,

View File

@@ -30,7 +30,7 @@
using namespace PostProcessUtil; using namespace PostProcessUtil;
bool CDownsampleEffect::ParseRules(const std::wstring& value) bool CDownsampleEffect::ParseRules(const std::wstring& value, bool report)
{ {
m_rules.clear(); m_rules.clear();
if (value.empty()) if (value.empty())
@@ -61,11 +61,13 @@ bool CDownsampleEffect::ParseRules(const std::wstring& value)
if (swscanf_s(start, L"%ux%u:%ux%u", if (swscanf_s(start, L"%ux%u:%ux%u",
&rule.x, &rule.y, &rule.targetX, &rule.targetY) != 4) &rule.x, &rule.y, &rule.targetX, &rule.targetY) != 4)
{ {
if (report)
DEBUG_ERROR("Unable to parse IDD downsample rule"); DEBUG_ERROR("Unable to parse IDD downsample rule");
m_rules.clear(); m_rules.clear();
return false; return false;
} }
if (report)
DEBUG_INFO("idd:downsample rule: %ux%u -> %ux%u%s", DEBUG_INFO("idd:downsample rule: %ux%u -> %ux%u%s",
rule.x, rule.y, rule.targetX, rule.targetY, rule.x, rule.y, rule.targetX, rule.targetY,
rule.greater ? " (greater-than)" : ""); rule.greater ? " (greater-than)" : "");
@@ -92,9 +94,9 @@ const CDownsampleEffect::Rule * CDownsampleEffect::MatchRule(
return match; return match;
} }
bool CDownsampleEffect::Init(const ComPtr<ID3D12Device3>& device) bool CDownsampleEffect::Init(const ComPtr<ID3D12Device3>& device, bool report)
{ {
if (!ParseRules(g_settings.ReadStringValue(L"Downsample"))) if (!ParseRules(g_settings.ReadStringValue(L"Downsample"), report))
return false; return false;
D3D12_STATIC_SAMPLER_DESC sampler = {}; D3D12_STATIC_SAMPLER_DESC sampler = {};

View File

@@ -51,13 +51,13 @@ private:
unsigned m_width = 0; unsigned m_width = 0;
unsigned m_height = 0; unsigned m_height = 0;
bool ParseRules(const std::wstring& value); bool ParseRules(const std::wstring& value, bool report);
const Rule * MatchRule(unsigned width, unsigned height) const; const Rule * MatchRule(unsigned width, unsigned height) const;
public: public:
const char * GetName() const override { return "Downsample"; } const char * GetName() const override { return "Downsample"; }
bool Init(const ComPtr<ID3D12Device3>& device); bool Init(const ComPtr<ID3D12Device3>& device, bool report = true);
PostProcessStatus SetFormat(const ComPtr<ID3D12Device3>& device, PostProcessStatus SetFormat(const ComPtr<ID3D12Device3>& device,
const D12FrameFormat& src, D12FrameFormat& dst) override; const D12FrameFormat& src, D12FrameFormat& dst) override;