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:
parent
6375e471f3
commit
f5af40afce
15 changed files with 46 additions and 46 deletions
|
|
@ -22,4 +22,4 @@ class CClearPassElement : public IPassElement {
|
|||
|
||||
private:
|
||||
SClearData m_data;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -16,4 +16,4 @@ bool CShadowPassElement::needsLiveBlur() {
|
|||
|
||||
bool CShadowPassElement::needsPrecomputeBlur() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,4 @@ class CShadowPassElement : public IPassElement {
|
|||
|
||||
private:
|
||||
SShadowData m_data;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue