diff --git a/src/d3d11/d3d11_blend.cpp b/src/d3d11/d3d11_blend.cpp index 1e86b6169..caacc869e 100644 --- a/src/d3d11/d3d11_blend.cpp +++ b/src/d3d11/d3d11_blend.cpp @@ -6,7 +6,8 @@ namespace dxvk { D3D11BlendState::D3D11BlendState( D3D11Device* device, const D3D11_BLEND_DESC1& desc) - : m_device(device), m_desc(desc), m_d3d10(this) { + : D3D11StateObject(device), + m_desc(desc), m_d3d10(this) { // If Independent Blend is disabled, we must ignore the // blend modes for render target 1 to 7. In Vulkan, all // blend modes need to be identical in that case. @@ -34,22 +35,6 @@ namespace dxvk { D3D11BlendState::~D3D11BlendState() { } - - - ULONG STDMETHODCALLTYPE D3D11BlendState::AddRef() { - ULONG refCount = m_refCount++; - if (!refCount) - m_device->AddRef(); - return refCount + 1; - } - - - ULONG STDMETHODCALLTYPE D3D11BlendState::Release() { - ULONG refCount = --m_refCount; - if (!refCount) - m_device->Release(); - return refCount; - } HRESULT STDMETHODCALLTYPE D3D11BlendState::QueryInterface(REFIID riid, void** ppvObject) { @@ -79,11 +64,6 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11BlendState::GetDevice(ID3D11Device** ppDevice) { - *ppDevice = ref(m_device); - } - - void STDMETHODCALLTYPE D3D11BlendState::GetDesc(D3D11_BLEND_DESC* pDesc) { pDesc->AlphaToCoverageEnable = m_desc.AlphaToCoverageEnable; pDesc->IndependentBlendEnable = m_desc.IndependentBlendEnable; diff --git a/src/d3d11/d3d11_blend.h b/src/d3d11/d3d11_blend.h index 77e0de1a2..5761d3ca7 100644 --- a/src/d3d11/d3d11_blend.h +++ b/src/d3d11/d3d11_blend.h @@ -11,7 +11,7 @@ namespace dxvk { class D3D11Device; - class D3D11BlendState : public D3D11DeviceChild { + class D3D11BlendState : public D3D11StateObject { public: @@ -21,18 +21,11 @@ namespace dxvk { D3D11Device* device, const D3D11_BLEND_DESC1& desc); ~D3D11BlendState(); - - ULONG STDMETHODCALLTYPE AddRef() final; - - ULONG STDMETHODCALLTYPE Release() final; HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice( - ID3D11Device **ppDevice) final; - void STDMETHODCALLTYPE GetDesc( D3D11_BLEND_DESC* pDesc) final; @@ -55,7 +48,6 @@ namespace dxvk { private: - D3D11Device* const m_device; D3D11_BLEND_DESC1 m_desc; std::array m_blendModes; @@ -63,8 +55,6 @@ namespace dxvk { DxvkLogicOpState m_loState; D3D10BlendState m_d3d10; - - std::atomic m_refCount = { 0u }; static DxvkBlendMode DecodeBlendMode( const D3D11_RENDER_TARGET_BLEND_DESC1& BlendDesc); diff --git a/src/d3d11/d3d11_buffer.cpp b/src/d3d11/d3d11_buffer.cpp index 946e4160c..687be0a51 100644 --- a/src/d3d11/d3d11_buffer.cpp +++ b/src/d3d11/d3d11_buffer.cpp @@ -9,7 +9,7 @@ namespace dxvk { D3D11Buffer::D3D11Buffer( D3D11Device* pDevice, const D3D11_BUFFER_DESC* pDesc) - : m_device (pDevice), + : D3D11DeviceChild(pDevice), m_desc (*pDesc), m_resource (this), m_d3d10 (this) { @@ -35,17 +35,17 @@ namespace dxvk { if (pDesc->BindFlags & D3D11_BIND_CONSTANT_BUFFER) { info.usage |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; - info.stages |= m_device->GetEnabledShaderStages(); + info.stages |= m_parent->GetEnabledShaderStages(); info.access |= VK_ACCESS_UNIFORM_READ_BIT; - if (m_device->GetOptions()->constantBufferRangeCheck) + if (m_parent->GetOptions()->constantBufferRangeCheck) info.usage |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; } if (pDesc->BindFlags & D3D11_BIND_SHADER_RESOURCE) { info.usage |= VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; - info.stages |= m_device->GetEnabledShaderStages(); + info.stages |= m_parent->GetEnabledShaderStages(); info.access |= VK_ACCESS_SHADER_READ_BIT; } @@ -58,7 +58,7 @@ namespace dxvk { if (pDesc->BindFlags & D3D11_BIND_UNORDERED_ACCESS) { info.usage |= VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; - info.stages |= m_device->GetEnabledShaderStages(); + info.stages |= m_parent->GetEnabledShaderStages(); info.access |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; } @@ -71,7 +71,7 @@ namespace dxvk { // Create the buffer and set the entire buffer slice as mapped, // so that we only have to update it when invalidating th buffer - m_buffer = m_device->GetDXVKDevice()->createBuffer(info, GetMemoryFlags()); + m_buffer = m_parent->GetDXVKDevice()->createBuffer(info, GetMemoryFlags()); m_mapped = m_buffer->getSliceHandle(); // For Stream Output buffers we need a counter @@ -120,11 +120,6 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11Buffer::GetDevice(ID3D11Device** ppDevice) { - *ppDevice = m_device.ref(); - } - - UINT STDMETHODCALLTYPE D3D11Buffer::GetEvictionPriority() { return DXGI_RESOURCE_PRIORITY_NORMAL; } @@ -161,7 +156,7 @@ namespace dxvk { // Check whether the given combination of buffer view // type and view format is supported by the device - DXGI_VK_FORMAT_INFO viewFormat = m_device->LookupFormat(Format, DXGI_VK_FORMAT_MODE_ANY); + DXGI_VK_FORMAT_INFO viewFormat = m_parent->LookupFormat(Format, DXGI_VK_FORMAT_MODE_ANY); VkFormatFeatureFlags features = GetBufferFormatFeatures(BindFlags); return CheckFormatFeatureSupport(viewFormat.Format, features); @@ -208,7 +203,7 @@ namespace dxvk { BOOL D3D11Buffer::CheckFormatFeatureSupport( VkFormat Format, VkFormatFeatureFlags Features) const { - VkFormatProperties properties = m_device->GetDXVKDevice()->adapter()->formatProperties(Format); + VkFormatProperties properties = m_parent->GetDXVKDevice()->adapter()->formatProperties(Format); return (properties.bufferFeatures & Features) == Features; } @@ -250,7 +245,7 @@ namespace dxvk { break; } - if (memoryFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT && m_device->GetOptions()->apitraceMode) { + if (memoryFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT && m_parent->GetOptions()->apitraceMode) { memoryFlags |= VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT; } @@ -260,7 +255,7 @@ namespace dxvk { Rc D3D11Buffer::CreateSoCounterBuffer() { - Rc device = m_device->GetDXVKDevice(); + Rc device = m_parent->GetDXVKDevice(); DxvkBufferCreateInfo info; info.size = sizeof(D3D11SOCounter); diff --git a/src/d3d11/d3d11_buffer.h b/src/d3d11/d3d11_buffer.h index f19e410bb..a2a94e088 100644 --- a/src/d3d11/d3d11_buffer.h +++ b/src/d3d11/d3d11_buffer.h @@ -48,9 +48,6 @@ namespace dxvk { REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice( - ID3D11Device **ppDevice) final; - void STDMETHODCALLTYPE GetType( D3D11_RESOURCE_DIMENSION *pResourceDimension) final; @@ -125,7 +122,6 @@ namespace dxvk { private: - const Com m_device; const D3D11_BUFFER_DESC m_desc; Rc m_buffer; diff --git a/src/d3d11/d3d11_class_linkage.cpp b/src/d3d11/d3d11_class_linkage.cpp index 64ef9e016..8070b6603 100644 --- a/src/d3d11/d3d11_class_linkage.cpp +++ b/src/d3d11/d3d11_class_linkage.cpp @@ -5,7 +5,7 @@ namespace dxvk { D3D11ClassLinkage::D3D11ClassLinkage( D3D11Device* pDevice) - : m_device(pDevice) { + : D3D11DeviceChild(pDevice) { } @@ -34,11 +34,6 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11ClassLinkage::GetDevice(ID3D11Device** ppDevice) { - *ppDevice = m_device.ref(); - } - - HRESULT STDMETHODCALLTYPE D3D11ClassLinkage::CreateClassInstance( LPCSTR pClassTypeName, UINT ConstantBufferOffset, diff --git a/src/d3d11/d3d11_class_linkage.h b/src/d3d11/d3d11_class_linkage.h index e50cb718e..7d1c324cc 100644 --- a/src/d3d11/d3d11_class_linkage.h +++ b/src/d3d11/d3d11_class_linkage.h @@ -20,9 +20,6 @@ namespace dxvk { REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice( - ID3D11Device **ppDevice) final; - HRESULT STDMETHODCALLTYPE CreateClassInstance( LPCSTR pClassTypeName, UINT ConstantBufferOffset, @@ -36,10 +33,6 @@ namespace dxvk { UINT InstanceIndex, ID3D11ClassInstance **ppInstance); - private: - - Com m_device; - }; } diff --git a/src/d3d11/d3d11_cmdlist.cpp b/src/d3d11/d3d11_cmdlist.cpp index d59d9b572..0ce56211a 100644 --- a/src/d3d11/d3d11_cmdlist.cpp +++ b/src/d3d11/d3d11_cmdlist.cpp @@ -6,7 +6,7 @@ namespace dxvk { D3D11CommandList::D3D11CommandList( D3D11Device* pDevice, UINT ContextFlags) - : m_device (pDevice), + : D3D11DeviceChild(pDevice), m_contextFlags(ContextFlags) { } @@ -34,11 +34,6 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11CommandList::GetDevice(ID3D11Device **ppDevice) { - *ppDevice = ref(m_device); - } - - UINT STDMETHODCALLTYPE D3D11CommandList::GetContextFlags() { return m_contextFlags; } @@ -80,11 +75,11 @@ namespace dxvk { void D3D11CommandList::MarkSubmitted() { if (m_submitted.exchange(true) && !m_warned.exchange(true) - && m_device->GetOptions()->dcSingleUseMode) { + && m_parent->GetOptions()->dcSingleUseMode) { Logger::warn( "D3D11: Command list submitted multiple times,\n" " but d3d11.dcSingleUseMode is enabled"); } } -} \ No newline at end of file +} diff --git a/src/d3d11/d3d11_cmdlist.h b/src/d3d11/d3d11_cmdlist.h index 323d301d8..ce207aaf4 100644 --- a/src/d3d11/d3d11_cmdlist.h +++ b/src/d3d11/d3d11_cmdlist.h @@ -18,9 +18,6 @@ namespace dxvk { REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice( - ID3D11Device **ppDevice) final; - UINT STDMETHODCALLTYPE GetContextFlags() final; void AddChunk( @@ -37,7 +34,6 @@ namespace dxvk { private: - D3D11Device* const m_device; UINT const m_contextFlags; std::vector m_chunks; @@ -50,4 +46,4 @@ namespace dxvk { }; -} \ No newline at end of file +} diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 768681e1a..88fa7cdfc 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -13,7 +13,7 @@ namespace dxvk { D3D11Device* pParent, const Rc& Device, DxvkCsChunkFlags CsFlags) - : m_parent (pParent), + : D3D11DeviceChild(pParent), m_contextExt(this), m_annotation(this), m_multithread(this, false), @@ -134,11 +134,6 @@ namespace dxvk { } } } - - - void STDMETHODCALLTYPE D3D11DeviceContext::GetDevice(ID3D11Device **ppDevice) { - *ppDevice = ref(m_parent); - } void STDMETHODCALLTYPE D3D11DeviceContext::ClearState() { diff --git a/src/d3d11/d3d11_context.h b/src/d3d11/d3d11_context.h index 8c029d867..de5b82b02 100644 --- a/src/d3d11/d3d11_context.h +++ b/src/d3d11/d3d11_context.h @@ -39,8 +39,6 @@ namespace dxvk { ID3D11View* pResourceView, const D3D11_RECT* pRects, UINT NumRects); - - void STDMETHODCALLTYPE GetDevice(ID3D11Device **ppDevice); void STDMETHODCALLTYPE ClearState(); @@ -706,7 +704,6 @@ namespace dxvk { protected: - D3D11Device* const m_parent; D3D11DeviceContextExt m_contextExt; D3D11UserDefinedAnnotation m_annotation; D3D10Multithread m_multithread; diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index c88833d94..c555728de 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -35,22 +35,6 @@ namespace dxvk { } - ULONG STDMETHODCALLTYPE D3D11ImmediateContext::AddRef() { - ULONG refCount = m_refCount++; - if (!refCount) - m_parent->AddRef(); - return refCount + 1; - } - - - ULONG STDMETHODCALLTYPE D3D11ImmediateContext::Release() { - ULONG refCount = --m_refCount; - if (!refCount) - m_parent->Release(); - return refCount; - } - - D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE D3D11ImmediateContext::GetType() { return D3D11_DEVICE_CONTEXT_IMMEDIATE; } diff --git a/src/d3d11/d3d11_context_imm.h b/src/d3d11/d3d11_context_imm.h index 02e72f1e1..8e259744a 100644 --- a/src/d3d11/d3d11_context_imm.h +++ b/src/d3d11/d3d11_context_imm.h @@ -21,10 +21,6 @@ namespace dxvk { const Rc& Device); ~D3D11ImmediateContext(); - ULONG STDMETHODCALLTYPE AddRef(); - - ULONG STDMETHODCALLTYPE Release(); - D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE GetType(); UINT STDMETHODCALLTYPE GetContextFlags(); @@ -116,8 +112,6 @@ namespace dxvk { DxvkCsThread m_csThread; bool m_csIsBusy = false; - std::atomic m_refCount = { 0 }; - Rc m_eventSignal; uint64_t m_eventCount = 0; diff --git a/src/d3d11/d3d11_depth_stencil.cpp b/src/d3d11/d3d11_depth_stencil.cpp index 9ff4830f6..b095e5eac 100644 --- a/src/d3d11/d3d11_depth_stencil.cpp +++ b/src/d3d11/d3d11_depth_stencil.cpp @@ -6,7 +6,8 @@ namespace dxvk { D3D11DepthStencilState::D3D11DepthStencilState( D3D11Device* device, const D3D11_DEPTH_STENCIL_DESC& desc) - : m_device(device), m_desc(desc), m_d3d10(this) { + : D3D11StateObject(device), + m_desc(desc), m_d3d10(this) { m_state.enableDepthTest = desc.DepthEnable; m_state.enableDepthWrite = desc.DepthWriteMask == D3D11_DEPTH_WRITE_MASK_ALL; m_state.enableStencilTest = desc.StencilEnable; @@ -19,22 +20,6 @@ namespace dxvk { D3D11DepthStencilState::~D3D11DepthStencilState() { } - - - ULONG STDMETHODCALLTYPE D3D11DepthStencilState::AddRef() { - ULONG refCount = m_refCount++; - if (!refCount) - m_device->AddRef(); - return refCount + 1; - } - - - ULONG STDMETHODCALLTYPE D3D11DepthStencilState::Release() { - ULONG refCount = --m_refCount; - if (!refCount) - m_device->Release(); - return refCount; - } HRESULT STDMETHODCALLTYPE D3D11DepthStencilState::QueryInterface(REFIID riid, void** ppvObject) { @@ -62,11 +47,6 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11DepthStencilState::GetDevice(ID3D11Device** ppDevice) { - *ppDevice = ref(m_device); - } - - void STDMETHODCALLTYPE D3D11DepthStencilState::GetDesc(D3D11_DEPTH_STENCIL_DESC* pDesc) { *pDesc = m_desc; } diff --git a/src/d3d11/d3d11_depth_stencil.h b/src/d3d11/d3d11_depth_stencil.h index c9335b5cb..6311259f4 100644 --- a/src/d3d11/d3d11_depth_stencil.h +++ b/src/d3d11/d3d11_depth_stencil.h @@ -11,7 +11,7 @@ namespace dxvk { class D3D11Device; - class D3D11DepthStencilState : public D3D11DeviceChild { + class D3D11DepthStencilState : public D3D11StateObject { public: @@ -21,18 +21,11 @@ namespace dxvk { D3D11Device* device, const D3D11_DEPTH_STENCIL_DESC& desc); ~D3D11DepthStencilState(); - - ULONG STDMETHODCALLTYPE AddRef() final; - - ULONG STDMETHODCALLTYPE Release() final; HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice( - ID3D11Device **ppDevice) final; - void STDMETHODCALLTYPE GetDesc( D3D11_DEPTH_STENCIL_DESC* pDesc) final; @@ -48,12 +41,9 @@ namespace dxvk { private: - D3D11Device* const m_device; D3D11_DEPTH_STENCIL_DESC m_desc; DxvkDepthStencilState m_state; D3D10DepthStencilState m_d3d10; - - std::atomic m_refCount = { 0u }; VkStencilOpState DecodeStencilOpState( const D3D11_DEPTH_STENCILOP_DESC& StencilDesc, diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index b7433873f..fa0006bc9 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -42,13 +42,13 @@ namespace dxvk { m_dxbcOptions (m_dxvkDevice, m_d3d11Options) { m_initializer = new D3D11Initializer(this); m_context = new D3D11ImmediateContext(this, m_dxvkDevice); - m_d3d10Device = new D3D10Device(this, m_context); + m_d3d10Device = new D3D10Device(this, m_context.ptr()); } D3D11Device::~D3D11Device() { delete m_d3d10Device; - delete m_context; + m_context = nullptr; delete m_initializer; } @@ -1757,22 +1757,22 @@ namespace dxvk { void STDMETHODCALLTYPE D3D11Device::GetImmediateContext(ID3D11DeviceContext** ppImmediateContext) { - *ppImmediateContext = ref(m_context); + *ppImmediateContext = m_context.ref(); } void STDMETHODCALLTYPE D3D11Device::GetImmediateContext1(ID3D11DeviceContext1** ppImmediateContext) { - *ppImmediateContext = ref(m_context); + *ppImmediateContext = m_context.ref(); } void STDMETHODCALLTYPE D3D11Device::GetImmediateContext2(ID3D11DeviceContext2** ppImmediateContext) { - *ppImmediateContext = ref(m_context); + *ppImmediateContext = m_context.ref(); } void STDMETHODCALLTYPE D3D11Device::GetImmediateContext3(ID3D11DeviceContext3** ppImmediateContext) { - *ppImmediateContext = ref(m_context); + *ppImmediateContext = m_context.ref(); } diff --git a/src/d3d11/d3d11_device.h b/src/d3d11/d3d11_device.h index 6d69e6360..dc629ae03 100644 --- a/src/d3d11/d3d11_device.h +++ b/src/d3d11/d3d11_device.h @@ -446,8 +446,8 @@ namespace dxvk { DxvkCsChunkPool m_csChunkPool; D3D11Initializer* m_initializer = nullptr; - D3D11ImmediateContext* m_context = nullptr; D3D10Device* m_d3d10Device = nullptr; + Com m_context; D3D11StateObjectSet m_bsStateObjects; D3D11StateObjectSet m_dsStateObjects; diff --git a/src/d3d11/d3d11_device_child.h b/src/d3d11/d3d11_device_child.h index 9e4a8a0e8..60eff07af 100644 --- a/src/d3d11/d3d11_device_child.h +++ b/src/d3d11/d3d11_device_child.h @@ -5,11 +5,18 @@ #include "../util/com/com_private_data.h" namespace dxvk { - - template class Wrapper = ComObject> - class D3D11DeviceChild : public Wrapper { + + class D3D11Device; + + template + class D3D11DeviceObject : public Base { public: + + D3D11DeviceObject(D3D11Device* pDevice) + : m_parent(pDevice) { + + } HRESULT STDMETHODCALLTYPE GetPrivateData( REFGUID guid, @@ -33,11 +40,91 @@ namespace dxvk { return m_privateData.setInterface( guid, pUnknown); } + + void STDMETHODCALLTYPE GetDevice( + ID3D11Device** ppDevice) final { + *ppDevice = ref(GetParentInterface()); + } + + protected: + + ID3D11Device* GetParentInterface() const { + // We don't know the definition of ID3D11Device + // here, because D3D11Device includes this file. + return reinterpret_cast(m_parent); + } + + D3D11Device* const m_parent; private: ComPrivateData m_privateData; }; + + + template + class D3D11DeviceChild : public D3D11DeviceObject> { + + public: + + D3D11DeviceChild(D3D11Device* pDevice) + : D3D11DeviceObject>(pDevice) { + + } + + ULONG STDMETHODCALLTYPE AddRef() { + uint32_t refCount = this->m_refCount++; + if (unlikely(!refCount)) { + this->AddRefPrivate(); + this->GetParentInterface()->AddRef(); + } + + return refCount + 1; + } + + ULONG STDMETHODCALLTYPE Release() { + uint32_t refCount = --this->m_refCount; + if (unlikely(!refCount)) { + auto* parent = this->GetParentInterface(); + this->ReleasePrivate(); + parent->Release(); + } + return refCount; + } + + }; + + template + class D3D11StateObject : public D3D11DeviceObject { + + public: + + D3D11StateObject(D3D11Device* pDevice) + : D3D11DeviceObject(pDevice) { + + } + + ULONG STDMETHODCALLTYPE AddRef() { + uint32_t refCount = this->m_refCount++; + if (unlikely(!refCount)) + this->GetParentInterface()->AddRef(); + + return refCount + 1; + } + + ULONG STDMETHODCALLTYPE Release() { + uint32_t refCount = --this->m_refCount; + if (unlikely(!refCount)) + this->GetParentInterface()->Release(); + + return refCount; + } + + private: + + std::atomic m_refCount = { 0u }; + + }; } diff --git a/src/d3d11/d3d11_input_layout.cpp b/src/d3d11/d3d11_input_layout.cpp index a33be9714..abf3d125b 100644 --- a/src/d3d11/d3d11_input_layout.cpp +++ b/src/d3d11/d3d11_input_layout.cpp @@ -9,7 +9,8 @@ namespace dxvk { const DxvkVertexAttribute* pAttributes, uint32_t numBindings, const DxvkVertexBinding* pBindings) - : m_device(pDevice), m_d3d10(this) { + : D3D11DeviceChild(pDevice), + m_d3d10(this) { m_attributes.resize(numAttributes); m_bindings.resize(numBindings); @@ -51,11 +52,6 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11InputLayout::GetDevice(ID3D11Device** ppDevice) { - *ppDevice = m_device.ref(); - } - - void D3D11InputLayout::BindToContext(const Rc& ctx) { ctx->setInputLayout( m_attributes.size(), diff --git a/src/d3d11/d3d11_input_layout.h b/src/d3d11/d3d11_input_layout.h index a0bd1deb6..8e472e2eb 100644 --- a/src/d3d11/d3d11_input_layout.h +++ b/src/d3d11/d3d11_input_layout.h @@ -25,9 +25,6 @@ namespace dxvk { REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice( - ID3D11Device** ppDevice) final; - void BindToContext( const Rc& ctx); @@ -40,8 +37,6 @@ namespace dxvk { private: - Com m_device; - std::vector m_attributes; std::vector m_bindings; diff --git a/src/d3d11/d3d11_query.cpp b/src/d3d11/d3d11_query.cpp index afe1a84a0..b7145739f 100644 --- a/src/d3d11/d3d11_query.cpp +++ b/src/d3d11/d3d11_query.cpp @@ -6,10 +6,11 @@ namespace dxvk { D3D11Query::D3D11Query( D3D11Device* device, const D3D11_QUERY_DESC1& desc) - : m_device(device), m_desc(desc), + : D3D11DeviceChild(device), + m_desc(desc), m_state(D3D11_VK_QUERY_INITIAL), m_d3d10(this) { - Rc dxvkDevice = m_device->GetDXVKDevice(); + Rc dxvkDevice = m_parent->GetDXVKDevice(); switch (m_desc.Query) { case D3D11_QUERY_EVENT: @@ -125,11 +126,6 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11Query::GetDevice(ID3D11Device **ppDevice) { - *ppDevice = m_device.ref(); - } - - UINT STDMETHODCALLTYPE D3D11Query::GetDataSize() { switch (m_desc.Query) { case D3D11_QUERY_EVENT: @@ -337,7 +333,7 @@ namespace dxvk { UINT64 D3D11Query::GetTimestampQueryFrequency() const { - Rc device = m_device->GetDXVKDevice(); + Rc device = m_parent->GetDXVKDevice(); Rc adapter = device->adapter(); VkPhysicalDeviceLimits limits = adapter->deviceProperties().limits; diff --git a/src/d3d11/d3d11_query.h b/src/d3d11/d3d11_query.h index 21378f443..06ac4a1a4 100644 --- a/src/d3d11/d3d11_query.h +++ b/src/d3d11/d3d11_query.h @@ -30,9 +30,6 @@ namespace dxvk { REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice( - ID3D11Device** ppDevice) final; - UINT STDMETHODCALLTYPE GetDataSize(); void STDMETHODCALLTYPE GetDesc(D3D11_QUERY_DESC* pDesc) final; @@ -96,7 +93,6 @@ namespace dxvk { private: - const Com m_device; D3D11_QUERY_DESC1 m_desc; D3D11_VK_QUERY_STATE m_state; diff --git a/src/d3d11/d3d11_rasterizer.cpp b/src/d3d11/d3d11_rasterizer.cpp index 2f7914d35..54e56ebf6 100644 --- a/src/d3d11/d3d11_rasterizer.cpp +++ b/src/d3d11/d3d11_rasterizer.cpp @@ -6,7 +6,8 @@ namespace dxvk { D3D11RasterizerState::D3D11RasterizerState( D3D11Device* device, const D3D11_RASTERIZER_DESC2& desc) - : m_device(device), m_desc(desc), m_d3d10(this) { + : D3D11StateObject(device), + m_desc(desc), m_d3d10(this) { // Polygon mode. Determines whether the rasterizer fills // a polygon or renders lines connecting the vertices. switch (desc.FillMode) { @@ -48,22 +49,6 @@ namespace dxvk { D3D11RasterizerState::~D3D11RasterizerState() { } - - - ULONG STDMETHODCALLTYPE D3D11RasterizerState::AddRef() { - ULONG refCount = m_refCount++; - if (!refCount) - m_device->AddRef(); - return refCount + 1; - } - - - ULONG STDMETHODCALLTYPE D3D11RasterizerState::Release() { - ULONG refCount = --m_refCount; - if (!refCount) - m_device->Release(); - return refCount; - } HRESULT STDMETHODCALLTYPE D3D11RasterizerState::QueryInterface(REFIID riid, void** ppvObject) { @@ -93,11 +78,6 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11RasterizerState::GetDevice(ID3D11Device** ppDevice) { - *ppDevice = ref(m_device); - } - - void STDMETHODCALLTYPE D3D11RasterizerState::GetDesc(D3D11_RASTERIZER_DESC* pDesc) { pDesc->FillMode = m_desc.FillMode; pDesc->CullMode = m_desc.CullMode; @@ -215,4 +195,4 @@ namespace dxvk { return S_OK; } -} \ No newline at end of file +} diff --git a/src/d3d11/d3d11_rasterizer.h b/src/d3d11/d3d11_rasterizer.h index 234496ae7..7b542f2ca 100644 --- a/src/d3d11/d3d11_rasterizer.h +++ b/src/d3d11/d3d11_rasterizer.h @@ -10,7 +10,7 @@ namespace dxvk { class D3D11Device; - class D3D11RasterizerState : public D3D11DeviceChild { + class D3D11RasterizerState : public D3D11StateObject { public: @@ -21,17 +21,10 @@ namespace dxvk { const D3D11_RASTERIZER_DESC2& desc); ~D3D11RasterizerState(); - ULONG STDMETHODCALLTYPE AddRef() final; - - ULONG STDMETHODCALLTYPE Release() final; - HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice( - ID3D11Device **ppDevice) final; - void STDMETHODCALLTYPE GetDesc( D3D11_RASTERIZER_DESC* pDesc) final; @@ -63,13 +56,10 @@ namespace dxvk { private: - D3D11Device* const m_device; D3D11_RASTERIZER_DESC2 m_desc; DxvkRasterizerState m_state; DxvkDepthBias m_depthBias; D3D10RasterizerState m_d3d10; - - std::atomic m_refCount = { 0u }; }; diff --git a/src/d3d11/d3d11_sampler.cpp b/src/d3d11/d3d11_sampler.cpp index ce0a12b53..397dc47bc 100644 --- a/src/d3d11/d3d11_sampler.cpp +++ b/src/d3d11/d3d11_sampler.cpp @@ -7,7 +7,8 @@ namespace dxvk { D3D11SamplerState::D3D11SamplerState( D3D11Device* device, const D3D11_SAMPLER_DESC& desc) - : m_device(device), m_desc(desc), m_d3d10(this) { + : D3D11StateObject(device), + m_desc(desc), m_d3d10(this) { DxvkSamplerCreateInfo info; // While D3D11_FILTER is technically an enum, its value bits @@ -57,22 +58,6 @@ namespace dxvk { D3D11SamplerState::~D3D11SamplerState() { } - - - ULONG STDMETHODCALLTYPE D3D11SamplerState::AddRef() { - ULONG refCount = m_refCount++; - if (!refCount) - m_device->AddRef(); - return refCount + 1; - } - - - ULONG STDMETHODCALLTYPE D3D11SamplerState::Release() { - ULONG refCount = --m_refCount; - if (!refCount) - m_device->Release(); - return refCount; - } HRESULT STDMETHODCALLTYPE D3D11SamplerState::QueryInterface(REFIID riid, void** ppvObject) { @@ -100,11 +85,6 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11SamplerState::GetDevice(ID3D11Device** ppDevice) { - *ppDevice = ref(m_device); - } - - void STDMETHODCALLTYPE D3D11SamplerState::GetDesc(D3D11_SAMPLER_DESC* pDesc) { *pDesc = m_desc; } diff --git a/src/d3d11/d3d11_sampler.h b/src/d3d11/d3d11_sampler.h index 95f66ee57..57fa139b4 100644 --- a/src/d3d11/d3d11_sampler.h +++ b/src/d3d11/d3d11_sampler.h @@ -10,7 +10,7 @@ namespace dxvk { class D3D11Device; - class D3D11SamplerState : public D3D11DeviceChild { + class D3D11SamplerState : public D3D11StateObject { public: @@ -20,18 +20,11 @@ namespace dxvk { D3D11Device* device, const D3D11_SAMPLER_DESC& desc); ~D3D11SamplerState(); - - ULONG STDMETHODCALLTYPE AddRef() final; - - ULONG STDMETHODCALLTYPE Release() final; HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice( - ID3D11Device **ppDevice) final; - void STDMETHODCALLTYPE GetDesc( D3D11_SAMPLER_DESC* pDesc) final; @@ -48,7 +41,6 @@ namespace dxvk { private: - D3D11Device* const m_device; D3D11_SAMPLER_DESC m_desc; Rc m_sampler; D3D10SamplerState m_d3d10; diff --git a/src/d3d11/d3d11_shader.h b/src/d3d11/d3d11_shader.h index 3a26a46c6..02a5fccbd 100644 --- a/src/d3d11/d3d11_shader.h +++ b/src/d3d11/d3d11_shader.h @@ -72,7 +72,8 @@ namespace dxvk { public: D3D11Shader(D3D11Device* device, const D3D11CommonShader& shader) - : m_device(device), m_shader(shader), m_d3d10(this) { } + : D3D11DeviceChild(device), + m_shader(shader), m_d3d10(this) { } ~D3D11Shader() { } @@ -97,10 +98,6 @@ namespace dxvk { return E_NOINTERFACE; } - void STDMETHODCALLTYPE GetDevice(ID3D11Device **ppDevice) final { - *ppDevice = m_device.ref(); - } - const D3D11CommonShader* GetCommonShader() const { return &m_shader; } @@ -111,7 +108,6 @@ namespace dxvk { private: - Com m_device; D3D11CommonShader m_shader; D3D10ShaderClass m_d3d10; diff --git a/src/d3d11/d3d11_state_object.cpp b/src/d3d11/d3d11_state_object.cpp index 8838c3fe5..33cc8a33f 100644 --- a/src/d3d11/d3d11_state_object.cpp +++ b/src/d3d11/d3d11_state_object.cpp @@ -3,8 +3,8 @@ namespace dxvk { D3D11DeviceContextState::D3D11DeviceContextState( - ID3D11Device* pDevice) - : m_device(pDevice) { + D3D11Device* pDevice) + : D3D11DeviceChild(pDevice) { } @@ -34,10 +34,4 @@ namespace dxvk { return E_NOINTERFACE; } - - void STDMETHODCALLTYPE D3D11DeviceContextState::GetDevice( - ID3D11Device** ppDevice) { - *ppDevice = m_device.ref(); - } - -} \ No newline at end of file +} diff --git a/src/d3d11/d3d11_state_object.h b/src/d3d11/d3d11_state_object.h index 9997d73cb..775a0951c 100644 --- a/src/d3d11/d3d11_state_object.h +++ b/src/d3d11/d3d11_state_object.h @@ -19,7 +19,7 @@ namespace dxvk { public: D3D11DeviceContextState( - ID3D11Device* pDevice); + D3D11Device* pDevice); ~D3D11DeviceContextState(); @@ -27,9 +27,6 @@ namespace dxvk { REFIID riid, void** ppvObject); - void STDMETHODCALLTYPE GetDevice( - ID3D11Device** ppDevice); - void SetState(const D3D11ContextState& State) { m_state = State; } @@ -40,7 +37,6 @@ namespace dxvk { private: - Com m_device; D3D11ContextState m_state; }; diff --git a/src/d3d11/d3d11_texture.cpp b/src/d3d11/d3d11_texture.cpp index 8cce00352..e2e6d45ba 100644 --- a/src/d3d11/d3d11_texture.cpp +++ b/src/d3d11/d3d11_texture.cpp @@ -214,11 +214,6 @@ namespace dxvk { } - void D3D11CommonTexture::GetDevice(ID3D11Device** ppDevice) const { - *ppDevice = m_device.ref(); - } - - bool D3D11CommonTexture::CheckViewCompatibility(UINT BindFlags, DXGI_FORMAT Format) const { const DxvkImageCreateInfo& imageInfo = m_image->info(); @@ -779,7 +774,8 @@ namespace dxvk { D3D11Texture1D::D3D11Texture1D( D3D11Device* pDevice, const D3D11_COMMON_TEXTURE_DESC* pDesc) - : m_texture (pDevice, pDesc, D3D11_RESOURCE_DIMENSION_TEXTURE1D, VK_NULL_HANDLE), + : D3D11DeviceChild(pDevice), + m_texture (pDevice, pDesc, D3D11_RESOURCE_DIMENSION_TEXTURE1D, VK_NULL_HANDLE), m_interop (this, &m_texture), m_surface (this, &m_texture), m_resource(this), @@ -840,11 +836,6 @@ namespace dxvk { return E_NOINTERFACE; } - - void STDMETHODCALLTYPE D3D11Texture1D::GetDevice(ID3D11Device** ppDevice) { - m_texture.GetDevice(ppDevice); - } - void STDMETHODCALLTYPE D3D11Texture1D::GetType(D3D11_RESOURCE_DIMENSION *pResourceDimension) { *pResourceDimension = D3D11_RESOURCE_DIMENSION_TEXTURE1D; @@ -881,7 +872,8 @@ namespace dxvk { D3D11Texture2D::D3D11Texture2D( D3D11Device* pDevice, const D3D11_COMMON_TEXTURE_DESC* pDesc) - : m_texture (pDevice, pDesc, D3D11_RESOURCE_DIMENSION_TEXTURE2D, VK_NULL_HANDLE), + : D3D11DeviceChild(pDevice), + m_texture (pDevice, pDesc, D3D11_RESOURCE_DIMENSION_TEXTURE2D, VK_NULL_HANDLE), m_interop (this, &m_texture), m_surface (this, &m_texture), m_resource(this), @@ -894,7 +886,8 @@ namespace dxvk { D3D11Device* pDevice, const D3D11_COMMON_TEXTURE_DESC* pDesc, VkImage vkImage) - : m_texture (pDevice, pDesc, D3D11_RESOURCE_DIMENSION_TEXTURE2D, vkImage), + : D3D11DeviceChild(pDevice), + m_texture (pDevice, pDesc, D3D11_RESOURCE_DIMENSION_TEXTURE2D, vkImage), m_interop (this, &m_texture), m_surface (this, &m_texture), m_resource(this), @@ -956,11 +949,6 @@ namespace dxvk { return E_NOINTERFACE; } - - void STDMETHODCALLTYPE D3D11Texture2D::GetDevice(ID3D11Device** ppDevice) { - m_texture.GetDevice(ppDevice); - } - void STDMETHODCALLTYPE D3D11Texture2D::GetType(D3D11_RESOURCE_DIMENSION *pResourceDimension) { *pResourceDimension = D3D11_RESOURCE_DIMENSION_TEXTURE2D; @@ -1014,7 +1002,8 @@ namespace dxvk { D3D11Texture3D::D3D11Texture3D( D3D11Device* pDevice, const D3D11_COMMON_TEXTURE_DESC* pDesc) - : m_texture (pDevice, pDesc, D3D11_RESOURCE_DIMENSION_TEXTURE3D, VK_NULL_HANDLE), + : D3D11DeviceChild(pDevice), + m_texture (pDevice, pDesc, D3D11_RESOURCE_DIMENSION_TEXTURE3D, VK_NULL_HANDLE), m_interop (this, &m_texture), m_resource(this), m_d3d10 (this) { @@ -1067,11 +1056,6 @@ namespace dxvk { return E_NOINTERFACE; } - - void STDMETHODCALLTYPE D3D11Texture3D::GetDevice(ID3D11Device** ppDevice) { - m_texture.GetDevice(ppDevice); - } - void STDMETHODCALLTYPE D3D11Texture3D::GetType(D3D11_RESOURCE_DIMENSION *pResourceDimension) { *pResourceDimension = D3D11_RESOURCE_DIMENSION_TEXTURE3D; diff --git a/src/d3d11/d3d11_texture.h b/src/d3d11/d3d11_texture.h index 635b3c40f..ef37d2646 100644 --- a/src/d3d11/d3d11_texture.h +++ b/src/d3d11/d3d11_texture.h @@ -173,12 +173,6 @@ namespace dxvk { */ DXGI_VK_FORMAT_MODE GetFormatMode() const; - /** - * \brief Retrieves parent D3D11 device - * \param [out] ppDevice The device - */ - void GetDevice(ID3D11Device** ppDevice) const; - /** * \brief Checks whether a view can be created for this textue * @@ -208,7 +202,7 @@ namespace dxvk { private: - Com m_device; + D3D11Device* const m_device; D3D11_COMMON_TEXTURE_DESC m_desc; D3D11_COMMON_TEXTURE_MAP_MODE m_mapMode; @@ -381,9 +375,6 @@ namespace dxvk { REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice( - ID3D11Device **ppDevice) final; - void STDMETHODCALLTYPE GetType( D3D11_RESOURCE_DIMENSION *pResourceDimension) final; @@ -434,9 +425,6 @@ namespace dxvk { REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice( - ID3D11Device **ppDevice) final; - void STDMETHODCALLTYPE GetType( D3D11_RESOURCE_DIMENSION *pResourceDimension) final; @@ -485,9 +473,6 @@ namespace dxvk { REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice( - ID3D11Device **ppDevice) final; - void STDMETHODCALLTYPE GetType( D3D11_RESOURCE_DIMENSION *pResourceDimension) final; diff --git a/src/d3d11/d3d11_view_dsv.cpp b/src/d3d11/d3d11_view_dsv.cpp index 2074dd38c..f0520c645 100644 --- a/src/d3d11/d3d11_view_dsv.cpp +++ b/src/d3d11/d3d11_view_dsv.cpp @@ -10,7 +10,8 @@ namespace dxvk { D3D11Device* pDevice, ID3D11Resource* pResource, const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc) - : m_device(pDevice), m_resource(pResource), m_desc(*pDesc), m_d3d10(this) { + : D3D11DeviceChild(pDevice), + m_resource(pResource), m_desc(*pDesc), m_d3d10(this) { ResourceAddRefPrivate(m_resource); D3D11_COMMON_RESOURCE_DESC resourceDesc; @@ -135,11 +136,6 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11DepthStencilView::GetDevice(ID3D11Device** ppDevice) { - *ppDevice = m_device.ref(); - } - - void STDMETHODCALLTYPE D3D11DepthStencilView::GetResource(ID3D11Resource** ppResource) { *ppResource = ref(m_resource); } diff --git a/src/d3d11/d3d11_view_dsv.h b/src/d3d11/d3d11_view_dsv.h index 537a6e4e6..41b6fcb1a 100644 --- a/src/d3d11/d3d11_view_dsv.h +++ b/src/d3d11/d3d11_view_dsv.h @@ -31,8 +31,6 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice(ID3D11Device** ppDevice) final; - void STDMETHODCALLTYPE GetResource(ID3D11Resource** ppResource) final; void STDMETHODCALLTYPE GetDesc(D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc) final; @@ -89,7 +87,6 @@ namespace dxvk { private: - Com m_device; ID3D11Resource* m_resource; D3D11_DEPTH_STENCIL_VIEW_DESC m_desc; D3D11_VK_VIEW_INFO m_info; diff --git a/src/d3d11/d3d11_view_rtv.cpp b/src/d3d11/d3d11_view_rtv.cpp index ed4477c1b..0fffe59eb 100644 --- a/src/d3d11/d3d11_view_rtv.cpp +++ b/src/d3d11/d3d11_view_rtv.cpp @@ -10,7 +10,8 @@ namespace dxvk { D3D11Device* pDevice, ID3D11Resource* pResource, const D3D11_RENDER_TARGET_VIEW_DESC1* pDesc) - : m_device(pDevice), m_resource(pResource), m_desc(*pDesc), m_d3d10(this) { + : D3D11DeviceChild(pDevice), + m_resource(pResource), m_desc(*pDesc), m_d3d10(this) { ResourceAddRefPrivate(m_resource); D3D11_COMMON_RESOURCE_DESC resourceDesc; @@ -142,11 +143,6 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11RenderTargetView::GetDevice(ID3D11Device** ppDevice) { - *ppDevice = m_device.ref(); - } - - void STDMETHODCALLTYPE D3D11RenderTargetView::GetResource(ID3D11Resource** ppResource) { *ppResource = ref(m_resource); } diff --git a/src/d3d11/d3d11_view_rtv.h b/src/d3d11/d3d11_view_rtv.h index ccf84d21d..1be76c0b4 100644 --- a/src/d3d11/d3d11_view_rtv.h +++ b/src/d3d11/d3d11_view_rtv.h @@ -27,8 +27,6 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice(ID3D11Device** ppDevice) final; - void STDMETHODCALLTYPE GetResource(ID3D11Resource** ppResource) final; void STDMETHODCALLTYPE GetDesc(D3D11_RENDER_TARGET_VIEW_DESC* pDesc) final; @@ -76,7 +74,6 @@ namespace dxvk { private: - Com m_device; ID3D11Resource* m_resource; D3D11_RENDER_TARGET_VIEW_DESC1 m_desc; D3D11_VK_VIEW_INFO m_info; diff --git a/src/d3d11/d3d11_view_srv.cpp b/src/d3d11/d3d11_view_srv.cpp index c11554741..16ce59214 100644 --- a/src/d3d11/d3d11_view_srv.cpp +++ b/src/d3d11/d3d11_view_srv.cpp @@ -10,7 +10,8 @@ namespace dxvk { D3D11Device* pDevice, ID3D11Resource* pResource, const D3D11_SHADER_RESOURCE_VIEW_DESC1* pDesc) - : m_device(pDevice), m_resource(pResource), m_desc(*pDesc), m_d3d10(this) { + : D3D11DeviceChild(pDevice), + m_resource(pResource), m_desc(*pDesc), m_d3d10(this) { ResourceAddRefPrivate(m_resource); D3D11_COMMON_RESOURCE_DESC resourceDesc; @@ -211,11 +212,6 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11ShaderResourceView::GetDevice(ID3D11Device** ppDevice) { - *ppDevice = m_device.ref(); - } - - void STDMETHODCALLTYPE D3D11ShaderResourceView::GetResource(ID3D11Resource** ppResource) { *ppResource = ref(m_resource); } diff --git a/src/d3d11/d3d11_view_srv.h b/src/d3d11/d3d11_view_srv.h index 62fbbb77f..89b534c8f 100644 --- a/src/d3d11/d3d11_view_srv.h +++ b/src/d3d11/d3d11_view_srv.h @@ -27,8 +27,6 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice(ID3D11Device** ppDevice) final; - void STDMETHODCALLTYPE GetResource(ID3D11Resource** ppResource) final; void STDMETHODCALLTYPE GetDesc(D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc) final; @@ -80,7 +78,6 @@ namespace dxvk { private: - Com m_device; ID3D11Resource* m_resource; D3D11_SHADER_RESOURCE_VIEW_DESC1 m_desc; D3D11_VK_VIEW_INFO m_info; diff --git a/src/d3d11/d3d11_view_uav.cpp b/src/d3d11/d3d11_view_uav.cpp index f392b5f48..44c2d8a03 100644 --- a/src/d3d11/d3d11_view_uav.cpp +++ b/src/d3d11/d3d11_view_uav.cpp @@ -10,7 +10,8 @@ namespace dxvk { D3D11Device* pDevice, ID3D11Resource* pResource, const D3D11_UNORDERED_ACCESS_VIEW_DESC1* pDesc) - : m_device(pDevice), m_resource(pResource), m_desc(*pDesc) { + : D3D11DeviceChild(pDevice), + m_resource(pResource), m_desc(*pDesc) { ResourceAddRefPrivate(m_resource); D3D11_COMMON_RESOURCE_DESC resourceDesc; @@ -147,11 +148,6 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11UnorderedAccessView::GetDevice(ID3D11Device** ppDevice) { - *ppDevice = m_device.ref(); - } - - void STDMETHODCALLTYPE D3D11UnorderedAccessView::GetResource(ID3D11Resource** ppResource) { *ppResource = ref(m_resource); } @@ -420,7 +416,7 @@ namespace dxvk { Rc D3D11UnorderedAccessView::CreateCounterBuffer() { - Rc device = m_device->GetDXVKDevice(); + Rc device = m_parent->GetDXVKDevice(); DxvkBufferCreateInfo info; info.size = sizeof(uint32_t); diff --git a/src/d3d11/d3d11_view_uav.h b/src/d3d11/d3d11_view_uav.h index c54c35650..4fe9164d0 100644 --- a/src/d3d11/d3d11_view_uav.h +++ b/src/d3d11/d3d11_view_uav.h @@ -29,8 +29,6 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) final; - void STDMETHODCALLTYPE GetDevice(ID3D11Device** ppDevice) final; - void STDMETHODCALLTYPE GetResource(ID3D11Resource** ppResource) final; void STDMETHODCALLTYPE GetDesc(D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc) final; @@ -78,7 +76,6 @@ namespace dxvk { private: - Com m_device; ID3D11Resource* m_resource; D3D11_UNORDERED_ACCESS_VIEW_DESC1 m_desc; D3D11_VK_VIEW_INFO m_info;