diff --git a/idd/LGIdd/capture/CSwapChainProcessor.cpp b/idd/LGIdd/capture/CSwapChainProcessor.cpp index 70815bf3..40dc3e66 100644 --- a/idd/LGIdd/capture/CSwapChainProcessor.cpp +++ b/idd/LGIdd/capture/CSwapChainProcessor.cpp @@ -137,8 +137,8 @@ bool CSwapChainProcessor::InitializePipeline() DEBUG_INFO("Software render adapter: post-processing disabled"); bool initialized = true; - for (CPostProcessor& postProcessor : m_postProcessors) - if (!postProcessor.Init(m_dx12Device, enableEffects)) + for (unsigned i = 0; i < ARRAYSIZE(m_postProcessors); ++i) + if (!m_postProcessors[i].Init(m_dx12Device, enableEffects, i == 0)) { initialized = false; break; @@ -153,12 +153,15 @@ bool CSwapChainProcessor::InitializePipeline() break; } + if (initialized) + m_postProcessors[0].LogEffects(); + if (!initialized) { for (CPostProcessor& postProcessor : m_postProcessors) { 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_WARN( @@ -680,17 +683,21 @@ bool CSwapChainProcessor::SwapChainNewFrame(ComPtr acquiredBuffer } bool configurationStable = false; + bool configured = false; for (unsigned pass = 0; pass < 2 && !configurationStable; ++pass) { for (unsigned i = 0; i < ARRAYSIZE(m_postProcessors); ++i) { bool formatChanged = false; - if (!m_postProcessors[i].Configure(srcFormat, &formatChanged)) + bool changed = false; + if (!m_postProcessors[i].Configure( + srcFormat, &formatChanged, &changed)) { m_frameProcessor->SetFullDamage(); return false; } + configured |= changed; if (i == 0) postProcessFormatChanged |= formatChanged; } @@ -711,6 +718,9 @@ bool CSwapChainProcessor::SwapChainNewFrame(ComPtr acquiredBuffer return false; } + if (configured) + m_postProcessors[0].LogActiveEffects(); + if (postProcessFormatChanged) m_frameProcessor->Invalidate(); else if (frameMetadataChanged) diff --git a/idd/LGIdd/d3d/CD3D12CommandQueue.cpp b/idd/LGIdd/d3d/CD3D12CommandQueue.cpp index cba735a7..0e205db7 100644 --- a/idd/LGIdd/d3d/CD3D12CommandQueue.cpp +++ b/idd/LGIdd/d3d/CD3D12CommandQueue.cpp @@ -123,7 +123,6 @@ bool CD3D12CommandSlot::Init(ID3D12Device3 * device, return false; } - DEBUG_INFO("Created CD3D12CommandSlot(%ls)", name); return true; } diff --git a/idd/LGIdd/postprocess/CPostProcessor.cpp b/idd/LGIdd/postprocess/CPostProcessor.cpp index 4208c596..bcfe67b5 100644 --- a/idd/LGIdd/postprocess/CPostProcessor.cpp +++ b/idd/LGIdd/postprocess/CPostProcessor.cpp @@ -31,7 +31,7 @@ #include bool CPostProcessor::Init(std::shared_ptr dx12Device, - bool enableEffects) + bool enableEffects, bool report) { m_dx12Device = dx12Device; m_device = dx12Device->GetDevice(); @@ -42,39 +42,48 @@ bool CPostProcessor::Init(std::shared_ptr dx12Device, std::unique_ptr colorTransform(new CColorTransformEffect()); if (colorTransform->Init(m_device)) - { - DEBUG_INFO("Created post-processing effect: %s", colorTransform->GetName()); m_effects.push_back(std::move(colorTransform)); - } else + { + DEBUG_ERROR("Failed to create post-processing effect: %s", + colorTransform->GetName()); return false; + } std::unique_ptr downsample(new CDownsampleEffect()); - if (downsample->Init(m_device)) - { - DEBUG_INFO("Created post-processing effect: %s", downsample->GetName()); + if (downsample->Init(m_device, report)) m_effects.push_back(std::move(downsample)); - } std::unique_ptr hdr16to10(new CHDR16to10Effect()); if (hdr16to10->Init(m_device)) - { - DEBUG_INFO("Created post-processing effect: %s", hdr16to10->GetName()); m_effects.push_back(std::move(hdr16to10)); - } else + { + DEBUG_ERROR("Failed to create post-processing effect: %s", + hdr16to10->GetName()); return false; + } std::unique_ptr rgb24(new CRGB24Effect()); if (rgb24->Init(m_device)) - { - DEBUG_INFO("Created post-processing effect: %s", rgb24->GetName()); m_effects.push_back(std::move(rgb24)); - } return true; } +void CPostProcessor::LogEffects() const +{ + for (const std::unique_ptr& effect : m_effects) + DEBUG_INFO("Created post-processing effect: %s", effect->GetName()); +} + +void CPostProcessor::LogActiveEffects() const +{ + for (const std::unique_ptr& effect : m_effects) + if (effect->Enabled) + DEBUG_INFO("Post-processing effect active: %s", effect->GetName()); +} + void CPostProcessor::Reset() { m_effects.clear(); @@ -151,10 +160,12 @@ bool CPostProcessor::RequiresFullDamage() const } bool CPostProcessor::Configure(const D12FrameFormat& srcFormat, - bool * formatChanged) + bool * formatChanged, bool * configured) { if (formatChanged) *formatChanged = false; + if (configured) + *configured = false; if (!NeedsReconfigure(srcFormat)) { @@ -165,6 +176,9 @@ bool CPostProcessor::Configure(const D12FrameFormat& srcFormat, return true; } + if (configured) + *configured = true; + D12FrameFormat oldDst = m_dstFormat; D12FrameFormat cur = srcFormat; CPostProcessEffect * outputEffect = nullptr; @@ -180,7 +194,6 @@ bool CPostProcessor::Configure(const D12FrameFormat& srcFormat, effectsActive = true; cur = dst; outputEffect = effect.get(); - DEBUG_INFO("Post-processing effect active: %s", effect->GetName()); break; case PostProcessStatus::BYPASS_EFFECT: diff --git a/idd/LGIdd/postprocess/CPostProcessor.h b/idd/LGIdd/postprocess/CPostProcessor.h index 7ea627f8..8296c0f7 100644 --- a/idd/LGIdd/postprocess/CPostProcessor.h +++ b/idd/LGIdd/postprocess/CPostProcessor.h @@ -116,7 +116,9 @@ private: public: bool Init(std::shared_ptr dx12Device, - bool enableEffects); + bool enableEffects, bool report); + void LogEffects() const; + void LogActiveEffects() const; void Reset(); bool HasSameEffectChain(const CPostProcessor& other) const; @@ -124,7 +126,8 @@ public: void Update(const D12FrameFormat& srcFormat); bool NeedsReconfigure(const D12FrameFormat& srcFormat) 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); ComPtr Run( const ComPtr& commandList, diff --git a/idd/LGIdd/postprocess/effect/CDownsampleEffect.cpp b/idd/LGIdd/postprocess/effect/CDownsampleEffect.cpp index ba4057b6..9ba58cf9 100644 --- a/idd/LGIdd/postprocess/effect/CDownsampleEffect.cpp +++ b/idd/LGIdd/postprocess/effect/CDownsampleEffect.cpp @@ -30,7 +30,7 @@ using namespace PostProcessUtil; -bool CDownsampleEffect::ParseRules(const std::wstring& value) +bool CDownsampleEffect::ParseRules(const std::wstring& value, bool report) { m_rules.clear(); if (value.empty()) @@ -61,14 +61,16 @@ bool CDownsampleEffect::ParseRules(const std::wstring& value) if (swscanf_s(start, L"%ux%u:%ux%u", &rule.x, &rule.y, &rule.targetX, &rule.targetY) != 4) { - DEBUG_ERROR("Unable to parse IDD downsample rule"); + if (report) + DEBUG_ERROR("Unable to parse IDD downsample rule"); m_rules.clear(); return false; } - DEBUG_INFO("idd:downsample rule: %ux%u -> %ux%u%s", - rule.x, rule.y, rule.targetX, rule.targetY, - rule.greater ? " (greater-than)" : ""); + if (report) + DEBUG_INFO("idd:downsample rule: %ux%u -> %ux%u%s", + rule.x, rule.y, rule.targetX, rule.targetY, + rule.greater ? " (greater-than)" : ""); m_rules.push_back(rule); } @@ -92,9 +94,9 @@ const CDownsampleEffect::Rule * CDownsampleEffect::MatchRule( return match; } -bool CDownsampleEffect::Init(const ComPtr& device) +bool CDownsampleEffect::Init(const ComPtr& device, bool report) { - if (!ParseRules(g_settings.ReadStringValue(L"Downsample"))) + if (!ParseRules(g_settings.ReadStringValue(L"Downsample"), report)) return false; D3D12_STATIC_SAMPLER_DESC sampler = {}; diff --git a/idd/LGIdd/postprocess/effect/CDownsampleEffect.h b/idd/LGIdd/postprocess/effect/CDownsampleEffect.h index 50341af0..1c5efb33 100644 --- a/idd/LGIdd/postprocess/effect/CDownsampleEffect.h +++ b/idd/LGIdd/postprocess/effect/CDownsampleEffect.h @@ -51,13 +51,13 @@ private: unsigned m_width = 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; public: const char * GetName() const override { return "Downsample"; } - bool Init(const ComPtr& device); + bool Init(const ComPtr& device, bool report = true); PostProcessStatus SetFormat(const ComPtr& device, const D12FrameFormat& src, D12FrameFormat& dst) override;