2018-01-20 13:22:44 +01:00
|
|
|
#pragma once
|
|
|
|
|
2019-11-26 01:46:39 +01:00
|
|
|
#include "../util/util_time.h"
|
2018-06-04 23:31:49 +02:00
|
|
|
|
2020-03-19 23:29:32 +01:00
|
|
|
#include "../util/sync/sync_signal_win32.h"
|
|
|
|
|
2018-01-20 13:22:44 +01:00
|
|
|
#include "d3d11_context.h"
|
2019-05-03 16:41:44 +02:00
|
|
|
#include "d3d11_state_object.h"
|
2018-01-20 13:22:44 +01:00
|
|
|
|
|
|
|
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 {
|
2019-11-02 16:32:55 +01:00
|
|
|
friend class D3D11SwapChain;
|
2018-01-20 13:22:44 +01:00
|
|
|
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();
|
|
|
|
|
2018-10-17 16:52:46 +02:00
|
|
|
D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE GetType();
|
2018-01-20 13:22:44 +01:00
|
|
|
|
2018-10-17 16:52:46 +02:00
|
|
|
UINT STDMETHODCALLTYPE GetContextFlags();
|
2018-01-20 13:22:44 +01:00
|
|
|
|
2018-06-08 12:29:24 +02:00
|
|
|
HRESULT STDMETHODCALLTYPE GetData(
|
2019-11-02 13:10:59 +01:00
|
|
|
ID3D11Asynchronous* pAsync,
|
|
|
|
void* pData,
|
|
|
|
UINT DataSize,
|
|
|
|
UINT GetDataFlags);
|
2018-06-08 12:29:24 +02:00
|
|
|
|
2019-11-02 13:10:59 +01:00
|
|
|
void STDMETHODCALLTYPE Begin(
|
|
|
|
ID3D11Asynchronous* pAsync);
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE End(
|
|
|
|
ID3D11Asynchronous* pAsync);
|
2019-05-09 16:38:07 +02:00
|
|
|
|
2018-10-17 16:52:46 +02:00
|
|
|
void STDMETHODCALLTYPE Flush();
|
2018-01-20 13:22:44 +01:00
|
|
|
|
2019-09-16 13:12:13 +02:00
|
|
|
void STDMETHODCALLTYPE Flush1(
|
|
|
|
D3D11_CONTEXT_TYPE ContextType,
|
|
|
|
HANDLE hEvent);
|
|
|
|
|
2019-09-16 13:17:00 +02:00
|
|
|
HRESULT STDMETHODCALLTYPE Signal(
|
|
|
|
ID3D11Fence* pFence,
|
|
|
|
UINT64 Value);
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE Wait(
|
|
|
|
ID3D11Fence* pFence,
|
|
|
|
UINT64 Value);
|
|
|
|
|
2018-01-20 13:22:44 +01:00
|
|
|
void STDMETHODCALLTYPE ExecuteCommandList(
|
|
|
|
ID3D11CommandList* pCommandList,
|
2018-10-17 16:52:46 +02:00
|
|
|
BOOL RestoreContextState);
|
2018-01-20 13:22:44 +01:00
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE FinishCommandList(
|
2018-03-06 18:34:34 +01:00
|
|
|
BOOL RestoreDeferredContextState,
|
2018-10-17 16:52:46 +02:00
|
|
|
ID3D11CommandList **ppCommandList);
|
2018-01-20 13:22:44 +01:00
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE Map(
|
|
|
|
ID3D11Resource* pResource,
|
|
|
|
UINT Subresource,
|
|
|
|
D3D11_MAP MapType,
|
|
|
|
UINT MapFlags,
|
2018-10-17 16:52:46 +02:00
|
|
|
D3D11_MAPPED_SUBRESOURCE* pMappedResource);
|
2018-01-20 13:22:44 +01:00
|
|
|
|
|
|
|
void STDMETHODCALLTYPE Unmap(
|
|
|
|
ID3D11Resource* pResource,
|
2018-10-17 16:52:46 +02:00
|
|
|
UINT Subresource);
|
2019-05-09 13:04:07 +02:00
|
|
|
|
2018-10-25 20:54:10 +02:00
|
|
|
void STDMETHODCALLTYPE UpdateSubresource(
|
|
|
|
ID3D11Resource* pDstResource,
|
|
|
|
UINT DstSubresource,
|
|
|
|
const D3D11_BOX* pDstBox,
|
|
|
|
const void* pSrcData,
|
|
|
|
UINT SrcRowPitch,
|
|
|
|
UINT SrcDepthPitch);
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE UpdateSubresource1(
|
|
|
|
ID3D11Resource* pDstResource,
|
|
|
|
UINT DstSubresource,
|
|
|
|
const D3D11_BOX* pDstBox,
|
|
|
|
const void* pSrcData,
|
|
|
|
UINT SrcRowPitch,
|
|
|
|
UINT SrcDepthPitch,
|
|
|
|
UINT CopyFlags);
|
2019-05-09 13:04:07 +02:00
|
|
|
|
2018-03-17 14:09:16 +01:00
|
|
|
void STDMETHODCALLTYPE OMSetRenderTargets(
|
|
|
|
UINT NumViews,
|
|
|
|
ID3D11RenderTargetView* const* ppRenderTargetViews,
|
2018-10-17 16:52:46 +02:00
|
|
|
ID3D11DepthStencilView* pDepthStencilView);
|
2018-03-17 14:09:16 +01:00
|
|
|
|
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,
|
2018-10-17 16:52:46 +02:00
|
|
|
const UINT* pUAVInitialCounts);
|
2018-06-27 18:34:17 +02:00
|
|
|
|
2019-05-03 16:41:44 +02:00
|
|
|
void STDMETHODCALLTYPE SwapDeviceContextState(
|
|
|
|
ID3DDeviceContextState* pState,
|
|
|
|
ID3DDeviceContextState** ppPreviousState);
|
|
|
|
|
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
|
|
|
|
2020-03-19 23:29:32 +01:00
|
|
|
Rc<sync::Win32Fence> m_eventSignal;
|
|
|
|
uint64_t m_eventCount = 0;
|
|
|
|
|
2019-11-26 01:46:39 +01:00
|
|
|
dxvk::high_resolution_clock::time_point m_lastFlush
|
|
|
|
= dxvk::high_resolution_clock::now();
|
2018-01-20 23:12:03 +01:00
|
|
|
|
2019-05-03 16:41:44 +02:00
|
|
|
Com<D3D11DeviceContextState> m_stateObject;
|
|
|
|
|
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,
|
2019-09-19 20:28:22 +02:00
|
|
|
D3D11_MAP MapType,
|
2018-03-10 23:32:15 +01:00
|
|
|
UINT MapFlags);
|
|
|
|
|
2019-05-19 13:21:08 +02:00
|
|
|
void EmitCsChunk(DxvkCsChunkRef&& chunk);
|
|
|
|
|
2018-10-17 17:22:52 +02:00
|
|
|
void FlushImplicit(BOOL StrongHint);
|
2020-03-19 23:29:32 +01:00
|
|
|
|
|
|
|
void SignalEvent(HANDLE hEvent);
|
2018-01-20 22:52:18 +01:00
|
|
|
|
2018-01-20 13:22:44 +01:00
|
|
|
};
|
|
|
|
|
2018-07-15 19:45:40 +02:00
|
|
|
}
|