renderpass: use unique ptr instead of shared ptr

lets use unique ptrs instead of refcounting shared ptr when its not
needed, use rvalue reference to construct in vector directly.
This commit is contained in:
Tom Englund 2025-07-10 10:44:59 +02:00 committed by Vaxry
parent 6375e471f3
commit f5af40afce
15 changed files with 46 additions and 46 deletions

View file

@ -22,4 +22,4 @@ class CClearPassElement : public IPassElement {
private:
SClearData m_data;
};
};

View file

@ -18,8 +18,8 @@ bool CRenderPass::single() const {
return m_passElements.size() == 1;
}
void CRenderPass::add(SP<IPassElement> el) {
m_passElements.emplace_back(makeShared<SPassElementData>(CRegion{}, el));
void CRenderPass::add(UP<IPassElement>&& el) {
m_passElements.emplace_back(makeUnique<SPassElementData>(CRegion{}, std::move(el)));
}
void CRenderPass::simplify() {

View file

@ -11,7 +11,7 @@ class CRenderPass {
bool empty() const;
bool single() const;
void add(SP<IPassElement> elem);
void add(UP<IPassElement>&& elem);
void clear();
void removeAllOfType(const std::string& type);
@ -24,11 +24,11 @@ class CRenderPass {
struct SPassElementData {
CRegion elementDamage;
SP<IPassElement> element;
UP<IPassElement> element;
bool discard = false;
};
std::vector<SP<SPassElementData>> m_passElements;
std::vector<UP<SPassElementData>> m_passElements;
void simplify();
float oneBlurRadius();

View file

@ -16,4 +16,4 @@ bool CShadowPassElement::needsLiveBlur() {
bool CShadowPassElement::needsPrecomputeBlur() {
return false;
}
}

View file

@ -23,4 +23,4 @@ class CShadowPassElement : public IPassElement {
private:
SShadowData m_data;
};
};