From ca53eaf878f2ce86f3d1790937631ca3d3facb0d Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 29 Jan 2018 16:31:25 +0100 Subject: [PATCH] [general] Minor COM pointer improvements --- src/d3d11/d3d11_context.cpp | 6 +++--- src/util/com/com_pointer.h | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index ab72ba9a..d79bcf27 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -1728,7 +1728,7 @@ namespace dxvk { m_state.om.sampleMask = SampleMask; if (blendState == nullptr) - blendState = m_defaultBlendState.ptr(); + blendState = m_defaultBlendState; EmitCs([ cBlendState = std::move(blendState), @@ -1769,7 +1769,7 @@ namespace dxvk { m_state.om.dsState = depthStencilState; if (depthStencilState == nullptr) - depthStencilState = m_defaultDepthStencilState.ptr(); + depthStencilState = m_defaultDepthStencilState; EmitCs([cDepthStencilState = std::move(depthStencilState)] (DxvkContext* ctx) { @@ -1848,7 +1848,7 @@ namespace dxvk { m_state.rs.state = rasterizerState; if (rasterizerState == nullptr) - rasterizerState = m_defaultRasterizerState.ptr(); + rasterizerState = m_defaultRasterizerState; EmitCs([cRasterizerState = std::move(rasterizerState)] (DxvkContext* ctx) { diff --git a/src/util/com/com_pointer.h b/src/util/com/com_pointer.h index e6fe99bc..254f05bc 100644 --- a/src/util/com/com_pointer.h +++ b/src/util/com/com_pointer.h @@ -32,6 +32,13 @@ namespace dxvk { other.m_ptr = nullptr; } + Com& operator = (T* object) { + this->decRef(); + m_ptr = object; + this->incRef(); + return *this; + } + Com& operator = (const Com& other) { other.incRef(); this->decRef();