1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-29 04:06:24 +01:00

[d3d11] Move D3D11DeviceContextExt to D3D11CommonContext

Will be needed for both EmitCs and TrackSequenceNumber functions.
This commit is contained in:
Philip Rebohle 2022-08-03 17:24:34 +02:00
parent 3f5f731c42
commit a7c25a01f2
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
6 changed files with 38 additions and 18 deletions

View File

@ -15,7 +15,6 @@ namespace dxvk {
const Rc<DxvkDevice>& Device, const Rc<DxvkDevice>& Device,
DxvkCsChunkFlags CsFlags) DxvkCsChunkFlags CsFlags)
: D3D11DeviceChild<ID3D11DeviceContext4>(pParent), : D3D11DeviceChild<ID3D11DeviceContext4>(pParent),
m_contextExt(this),
m_multithread(this, false), m_multithread(this, false),
m_device (Device), m_device (Device),
m_staging (Device, StagingBufferSize), m_staging (Device, StagingBufferSize),

View File

@ -19,6 +19,7 @@ namespace dxvk {
class D3D11Device; class D3D11Device;
class D3D11DeviceContext : public D3D11DeviceChild<ID3D11DeviceContext4> { class D3D11DeviceContext : public D3D11DeviceChild<ID3D11DeviceContext4> {
template<typename T>
friend class D3D11DeviceContextExt; friend class D3D11DeviceContextExt;
// Needed in order to call EmitCs for pushing markers // Needed in order to call EmitCs for pushing markers
template<typename T> template<typename T>
@ -687,7 +688,6 @@ namespace dxvk {
protected: protected:
D3D11DeviceContextExt m_contextExt;
D3D10Multithread m_multithread; D3D10Multithread m_multithread;
Rc<DxvkDevice> m_device; Rc<DxvkDevice> m_device;

View File

@ -10,6 +10,7 @@ namespace dxvk {
const Rc<DxvkDevice>& Device, const Rc<DxvkDevice>& Device,
DxvkCsChunkFlags CsFlags) DxvkCsChunkFlags CsFlags)
: D3D11DeviceContext(pParent, Device, CsFlags), : D3D11DeviceContext(pParent, Device, CsFlags),
m_contextExt(static_cast<ContextType*>(this)),
m_annotation(static_cast<ContextType*>(this), Device) { m_annotation(static_cast<ContextType*>(this), Device) {
} }

View File

@ -89,6 +89,7 @@ namespace dxvk {
protected: protected:
D3D11DeviceContextExt<ContextType> m_contextExt;
D3D11UserDefinedAnnotation<ContextType> m_annotation; D3D11UserDefinedAnnotation<ContextType> m_annotation;
void UpdateResource( void UpdateResource(

View File

@ -3,38 +3,44 @@
#include <cstring> #include <cstring>
#include "d3d11_device.h" #include "d3d11_device.h"
#include "d3d11_context.h" #include "d3d11_context_imm.h"
#include "d3d11_context_def.h"
#include "d3d11_cuda.h" #include "d3d11_cuda.h"
#include "../util/log/log.h" #include "../util/log/log.h"
namespace dxvk { namespace dxvk {
D3D11DeviceContextExt::D3D11DeviceContextExt( template<typename ContextType>
D3D11DeviceContext* pContext) D3D11DeviceContextExt<ContextType>::D3D11DeviceContextExt(
ContextType* pContext)
: m_ctx(pContext) { : m_ctx(pContext) {
} }
ULONG STDMETHODCALLTYPE D3D11DeviceContextExt::AddRef() { template<typename ContextType>
ULONG STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::AddRef() {
return m_ctx->AddRef(); return m_ctx->AddRef();
} }
ULONG STDMETHODCALLTYPE D3D11DeviceContextExt::Release() { template<typename ContextType>
ULONG STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::Release() {
return m_ctx->Release(); return m_ctx->Release();
} }
HRESULT STDMETHODCALLTYPE D3D11DeviceContextExt::QueryInterface( template<typename ContextType>
HRESULT STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::QueryInterface(
REFIID riid, REFIID riid,
void** ppvObject) { void** ppvObject) {
return m_ctx->QueryInterface(riid, ppvObject); return m_ctx->QueryInterface(riid, ppvObject);
} }
void STDMETHODCALLTYPE D3D11DeviceContextExt::MultiDrawIndirect( template<typename ContextType>
void STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::MultiDrawIndirect(
UINT DrawCount, UINT DrawCount,
ID3D11Buffer* pBufferForArgs, ID3D11Buffer* pBufferForArgs,
UINT ByteOffsetForArgs, UINT ByteOffsetForArgs,
@ -52,7 +58,8 @@ namespace dxvk {
} }
void STDMETHODCALLTYPE D3D11DeviceContextExt::MultiDrawIndexedIndirect( template<typename ContextType>
void STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::MultiDrawIndexedIndirect(
UINT DrawCount, UINT DrawCount,
ID3D11Buffer* pBufferForArgs, ID3D11Buffer* pBufferForArgs,
UINT ByteOffsetForArgs, UINT ByteOffsetForArgs,
@ -70,7 +77,8 @@ namespace dxvk {
} }
void STDMETHODCALLTYPE D3D11DeviceContextExt::MultiDrawIndirectCount( template<typename ContextType>
void STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::MultiDrawIndirectCount(
UINT MaxDrawCount, UINT MaxDrawCount,
ID3D11Buffer* pBufferForCount, ID3D11Buffer* pBufferForCount,
UINT ByteOffsetForCount, UINT ByteOffsetForCount,
@ -91,7 +99,8 @@ namespace dxvk {
} }
void STDMETHODCALLTYPE D3D11DeviceContextExt::MultiDrawIndexedIndirectCount( template<typename ContextType>
void STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::MultiDrawIndexedIndirectCount(
UINT MaxDrawCount, UINT MaxDrawCount,
ID3D11Buffer* pBufferForCount, ID3D11Buffer* pBufferForCount,
UINT ByteOffsetForCount, UINT ByteOffsetForCount,
@ -112,7 +121,8 @@ namespace dxvk {
} }
void STDMETHODCALLTYPE D3D11DeviceContextExt::SetDepthBoundsTest( template<typename ContextType>
void STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::SetDepthBoundsTest(
BOOL Enable, BOOL Enable,
FLOAT MinDepthBounds, FLOAT MinDepthBounds,
FLOAT MaxDepthBounds) { FLOAT MaxDepthBounds) {
@ -129,7 +139,8 @@ namespace dxvk {
} }
void STDMETHODCALLTYPE D3D11DeviceContextExt::SetBarrierControl( template<typename ContextType>
void STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::SetBarrierControl(
UINT ControlFlags) { UINT ControlFlags) {
D3D10DeviceLock lock = m_ctx->LockContext(); D3D10DeviceLock lock = m_ctx->LockContext();
DxvkBarrierControlFlags flags; DxvkBarrierControlFlags flags;
@ -146,7 +157,8 @@ namespace dxvk {
} }
bool STDMETHODCALLTYPE D3D11DeviceContextExt::LaunchCubinShaderNVX(IUnknown* hShader, uint32_t GridX, uint32_t GridY, uint32_t GridZ, template<typename ContextType>
bool STDMETHODCALLTYPE D3D11DeviceContextExt<ContextType>::LaunchCubinShaderNVX(IUnknown* hShader, uint32_t GridX, uint32_t GridY, uint32_t GridZ,
const void* pParams, uint32_t ParamSize, void* const* pReadResources, uint32_t NumReadResources, void* const* pWriteResources, uint32_t NumWriteResources) { const void* pParams, uint32_t ParamSize, void* const* pReadResources, uint32_t NumReadResources, void* const* pWriteResources, uint32_t NumWriteResources) {
D3D10DeviceLock lock = m_ctx->LockContext(); D3D10DeviceLock lock = m_ctx->LockContext();
@ -202,4 +214,9 @@ namespace dxvk {
return true; return true;
} }
template class D3D11DeviceContextExt<D3D11DeferredContext>;
template class D3D11DeviceContextExt<D3D11ImmediateContext>;
} }

View File

@ -4,14 +4,16 @@
namespace dxvk { namespace dxvk {
class D3D11DeviceContext; class D3D11DeferredContext;
class D3D11ImmediateContext;
template<typename ContextType>
class D3D11DeviceContextExt : public ID3D11VkExtContext1 { class D3D11DeviceContextExt : public ID3D11VkExtContext1 {
public: public:
D3D11DeviceContextExt( D3D11DeviceContextExt(
D3D11DeviceContext* pContext); ContextType* pContext);
ULONG STDMETHODCALLTYPE AddRef(); ULONG STDMETHODCALLTYPE AddRef();
@ -71,7 +73,7 @@ namespace dxvk {
private: private:
D3D11DeviceContext* m_ctx; ContextType* m_ctx;
}; };