Skip to content

Commit 2757013

Browse files
committed
Ability to compare ui_shader instances
1 parent 528e9c5 commit 2757013

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

src/Include/xrRender/FactoryPtr.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ class FactoryPtr
7171
[[nodiscard]]
7272
bool operator!() const { return m_pObject == nullptr; }
7373

74+
[[nodiscard]]
75+
bool operator==(const FactoryPtr& other) const
76+
{
77+
return *m_pObject == *other.m_pObject;
78+
}
79+
7480
private:
7581
void CreateObject();
7682
void DestroyObject();

src/Include/xrRender/UIShader.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ class IUIShader
1111
virtual bool inited() = 0;
1212
virtual void destroy() = 0;
1313

14+
[[nodiscard]]
15+
virtual bool operator==(const IUIShader& other) const = 0;
16+
1417
virtual bool GetBaseTextureResolution(Fvector2& res) = 0;
1518
virtual xrImTextureData GetImGuiTextureId() = 0;
1619
};

src/Layers/xrRender/dxUIShader.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ void dxUIShader::Copy(IUIShader& _in) { *this = *((dxUIShader*)&_in); }
77
void dxUIShader::create(LPCSTR sh, LPCSTR tex) { hShader.create(sh, tex); }
88
void dxUIShader::destroy() { hShader.destroy(); }
99

10+
bool dxUIShader::operator==(const IUIShader& other) const
11+
{
12+
return hShader == static_cast<const dxUIShader&>(other).hShader;
13+
}
14+
1015
CTexture* dxUIShader::GetBaseTexture() const
1116
{
1217
if (!hShader)

src/Layers/xrRender/dxUIShader.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class dxUIShader : public IUIShader
1717
virtual bool inited() { return hShader; }
1818
virtual void destroy();
1919

20+
bool operator==(const IUIShader& other) const override;
21+
2022
CTexture* GetBaseTexture() const;
2123
bool GetBaseTextureResolution(Fvector2& res) override;
2224
xrImTextureData GetImGuiTextureId() override;

0 commit comments

Comments
 (0)