2018-01-20 13:22:44 +01:00
|
|
|
#pragma once
|
|
|
|
|
2018-06-04 23:31:49 +02:00
|
|
|
#include <chrono>
|
|
|
|
|
2018-01-20 13:22:44 +01:00
|
|
|
#include "d3d11_context.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
2018-03-14 14:40:09 +01:00
|
|
|
class D3D11Buffer;
|
|
|
|
class D3D11CommonTexture;
|
|
|
|
|
2018-01-20 13:22:44 +01:00
|
|
|
class D3D11ImmediateContext : public D3D11DeviceContext {
|
|
|
|
public:
|
|
|
|
|
|
|
|
D3D11ImmediateContext(
|
2018-04-28 14:17:52 +02:00
|
|
|
D3D11Device* pParent,
|
|
|
|
const Rc<DxvkDevice>& Device);
|
2018-01-20 13:22:44 +01:00
|
|
|
~D3D11ImmediateContext();
|
|
|
|
|
|
|
|
ULONG STDMETHODCALLTYPE AddRef() final;
|
|
|
|
|
|
|
|
ULONG STDMETHODCALLTYPE Release() final;
|
|
|
|
|
|
|
|
D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE GetType() final;
|
|
|
|
|
|
|
|
UINT STDMETHODCALLTYPE GetContextFlags() final;
|
|
|
|
|
2018-06-08 12:29:24 +02:00
|
|
|
HRESULT STDMETHODCALLTYPE GetData(
|
|
|
|
ID3D11Asynchronous* pAsync,
|
|
|
|
void* pData,
|
|
|
|
UINT DataSize,
|
|
|
|
UINT GetDataFlags) final;
|
|
|
|
|
2018-01-20 13:22:44 +01:00
|
|
|
void STDMETHODCALLTYPE Flush() final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE ExecuteCommandList(
|
|
|
|
ID3D11CommandList* pCommandList,
|
2018-03-06 18:34:34 +01:00
|
|
|
BOOL RestoreContextState) final;
|
2018-01-20 13:22:44 +01:00
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE FinishCommandList(
|
2018-03-06 18:34:34 +01:00
|
|
|
BOOL RestoreDeferredContextState,
|
2018-01-20 13:22:44 +01:00
|
|
|
ID3D11CommandList **ppCommandList) final;
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE Map(
|
|
|
|
ID3D11Resource* pResource,
|
|
|
|
UINT Subresource,
|
|
|
|
D3D11_MAP MapType,
|
|
|
|
UINT MapFlags,
|
|
|
|
D3D11_MAPPED_SUBRESOURCE* pMappedResource) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE Unmap(
|
|
|
|
ID3D11Resource* pResource,
|
|
|
|
UINT Subresource) final;
|
|
|
|
|
2018-06-27 18:34:17 +02:00
|
|
|
void STDMETHODCALLTYPE CopySubresourceRegion(
|
|
|
|
ID3D11Resource* pDstResource,
|
|
|
|
UINT DstSubresource,
|
|
|
|
UINT DstX,
|
|
|
|
UINT DstY,
|
|
|
|
UINT DstZ,
|
|
|
|
ID3D11Resource* pSrcResource,
|
|
|
|
UINT SrcSubresource,
|
|
|
|
const D3D11_BOX* pSrcBox) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE CopySubresourceRegion1(
|
|
|
|
ID3D11Resource* pDstResource,
|
|
|
|
UINT DstSubresource,
|
|
|
|
UINT DstX,
|
|
|
|
UINT DstY,
|
|
|
|
UINT DstZ,
|
|
|
|
ID3D11Resource* pSrcResource,
|
|
|
|
UINT SrcSubresource,
|
|
|
|
const D3D11_BOX* pSrcBox,
|
|
|
|
UINT CopyFlags) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE CopyResource(
|
|
|
|
ID3D11Resource* pDstResource,
|
|
|
|
ID3D11Resource* pSrcResource) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE GenerateMips(
|
|
|
|
ID3D11ShaderResourceView* pShaderResourceView) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE UpdateSubresource(
|
|
|
|
ID3D11Resource* pDstResource,
|
|
|
|
UINT DstSubresource,
|
|
|
|
const D3D11_BOX* pDstBox,
|
|
|
|
const void* pSrcData,
|
|
|
|
UINT SrcRowPitch,
|
|
|
|
UINT SrcDepthPitch) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE UpdateSubresource1(
|
|
|
|
ID3D11Resource* pDstResource,
|
|
|
|
UINT DstSubresource,
|
|
|
|
const D3D11_BOX* pDstBox,
|
|
|
|
const void* pSrcData,
|
|
|
|
UINT SrcRowPitch,
|
|
|
|
UINT SrcDepthPitch,
|
|
|
|
UINT CopyFlags) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE ResolveSubresource(
|
|
|
|
ID3D11Resource* pDstResource,
|
|
|
|
UINT DstSubresource,
|
|
|
|
ID3D11Resource* pSrcResource,
|
|
|
|
UINT SrcSubresource,
|
|
|
|
DXGI_FORMAT Format) final;
|
|
|
|
|
2018-03-17 14:09:16 +01:00
|
|
|
void STDMETHODCALLTYPE OMSetRenderTargets(
|
|
|
|
UINT NumViews,
|
|
|
|
ID3D11RenderTargetView* const* ppRenderTargetViews,
|
|
|
|
ID3D11DepthStencilView* pDepthStencilView) final;
|
|
|
|
|
2018-06-27 18:34:17 +02:00
|
|
|
void STDMETHODCALLTYPE OMSetRenderTargetsAndUnorderedAccessViews(
|
|
|
|
UINT NumRTVs,
|
|
|
|
ID3D11RenderTargetView* const* ppRenderTargetViews,
|
|
|
|
ID3D11DepthStencilView* pDepthStencilView,
|
|
|
|
UINT UAVStartSlot,
|
|
|
|
UINT NumUAVs,
|
|
|
|
ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
|
|
|
|
const UINT* pUAVInitialCounts) final;
|
|
|
|
|
2018-01-21 18:04:22 +01:00
|
|
|
void SynchronizeCsThread();
|
2018-01-20 13:22:44 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2018-01-20 23:12:03 +01:00
|
|
|
DxvkCsThread m_csThread;
|
2018-03-22 12:58:26 +01:00
|
|
|
bool m_csIsBusy = false;
|
2018-06-04 23:31:49 +02:00
|
|
|
|
|
|
|
std::chrono::high_resolution_clock::time_point m_lastFlush
|
|
|
|
= std::chrono::high_resolution_clock::now();
|
2018-01-20 23:12:03 +01:00
|
|
|
|
2018-03-14 14:40:09 +01:00
|
|
|
HRESULT MapBuffer(
|
|
|
|
D3D11Buffer* pResource,
|
|
|
|
D3D11_MAP MapType,
|
|
|
|
UINT MapFlags,
|
|
|
|
D3D11_MAPPED_SUBRESOURCE* pMappedResource);
|
|
|
|
|
|
|
|
HRESULT MapImage(
|
|
|
|
D3D11CommonTexture* pResource,
|
|
|
|
UINT Subresource,
|
|
|
|
D3D11_MAP MapType,
|
|
|
|
UINT MapFlags,
|
|
|
|
D3D11_MAPPED_SUBRESOURCE* pMappedResource);
|
|
|
|
|
|
|
|
void UnmapImage(
|
|
|
|
D3D11CommonTexture* pResource,
|
|
|
|
UINT Subresource);
|
|
|
|
|
2018-01-21 18:04:22 +01:00
|
|
|
void SynchronizeDevice();
|
2018-01-21 02:57:36 +01:00
|
|
|
|
2018-03-10 23:32:15 +01:00
|
|
|
bool WaitForResource(
|
|
|
|
const Rc<DxvkResource>& Resource,
|
|
|
|
UINT MapFlags);
|
|
|
|
|
2018-08-27 16:07:38 +02:00
|
|
|
void EmitCsChunk(DxvkCsChunkRef&& chunk) final;
|
2018-06-04 23:31:49 +02:00
|
|
|
|
|
|
|
void FlushImplicit();
|
2018-01-20 22:52:18 +01:00
|
|
|
|
2018-01-20 13:22:44 +01:00
|
|
|
};
|
|
|
|
|
2018-07-15 19:45:40 +02:00
|
|
|
}
|