2018-01-23 08:23:31 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-01-23 11:03:26 +00:00
|
|
|
#include "d3d11_cmdlist.h"
|
2022-08-03 20:37:30 +01:00
|
|
|
#include "d3d11_context.h"
|
2018-01-23 08:23:31 +00:00
|
|
|
|
2018-03-25 12:24:03 +01:00
|
|
|
#include <vector>
|
2018-03-19 10:49:48 +00:00
|
|
|
|
2018-01-23 08:23:31 +00:00
|
|
|
namespace dxvk {
|
|
|
|
|
2018-03-19 02:19:13 +00:00
|
|
|
struct D3D11DeferredContextMapEntry {
|
2022-02-10 13:23:53 +00:00
|
|
|
D3D11DeferredContextMapEntry() { }
|
|
|
|
D3D11DeferredContextMapEntry(
|
|
|
|
ID3D11Resource* pResource,
|
|
|
|
UINT Subresource,
|
|
|
|
D3D11_RESOURCE_DIMENSION ResourceType,
|
|
|
|
const D3D11_MAPPED_SUBRESOURCE& MappedResource)
|
|
|
|
: Resource(pResource, Subresource, ResourceType),
|
|
|
|
MapInfo(MappedResource) { }
|
|
|
|
|
|
|
|
D3D11ResourceRef Resource;
|
|
|
|
D3D11_MAPPED_SUBRESOURCE MapInfo;
|
2018-03-19 02:19:13 +00:00
|
|
|
};
|
|
|
|
|
2022-08-03 15:33:54 +01:00
|
|
|
class D3D11DeferredContext : public D3D11CommonContext<D3D11DeferredContext> {
|
2022-08-04 17:40:07 +01:00
|
|
|
friend class D3D11CommonContext<D3D11DeferredContext>;
|
2018-01-23 08:23:31 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
D3D11DeferredContext(
|
2018-04-28 13:17:52 +01:00
|
|
|
D3D11Device* pParent,
|
|
|
|
const Rc<DxvkDevice>& Device,
|
|
|
|
UINT ContextFlags);
|
2018-01-23 08:23:31 +00:00
|
|
|
|
2018-06-08 11:29:24 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE GetData(
|
2019-11-02 12:06:44 +00:00
|
|
|
ID3D11Asynchronous* pAsync,
|
|
|
|
void* pData,
|
|
|
|
UINT DataSize,
|
|
|
|
UINT GetDataFlags);
|
2018-06-08 11:29:24 +01:00
|
|
|
|
2019-11-02 12:06:44 +00:00
|
|
|
void STDMETHODCALLTYPE Begin(
|
|
|
|
ID3D11Asynchronous* pAsync);
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE End(
|
|
|
|
ID3D11Asynchronous* pAsync);
|
|
|
|
|
2018-10-17 15:52:46 +01:00
|
|
|
void STDMETHODCALLTYPE Flush();
|
2019-09-16 12:12:13 +01:00
|
|
|
|
|
|
|
void STDMETHODCALLTYPE Flush1(
|
|
|
|
D3D11_CONTEXT_TYPE ContextType,
|
|
|
|
HANDLE hEvent);
|
|
|
|
|
2019-09-16 12:17:00 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE Signal(
|
|
|
|
ID3D11Fence* pFence,
|
|
|
|
UINT64 Value);
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE Wait(
|
|
|
|
ID3D11Fence* pFence,
|
|
|
|
UINT64 Value);
|
|
|
|
|
2018-01-23 08:23:31 +00:00
|
|
|
void STDMETHODCALLTYPE ExecuteCommandList(
|
2019-09-16 12:12:13 +01:00
|
|
|
ID3D11CommandList* pCommandList,
|
|
|
|
BOOL RestoreContextState);
|
2018-01-23 08:23:31 +00:00
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE FinishCommandList(
|
2019-09-16 12:12:13 +01:00
|
|
|
BOOL RestoreDeferredContextState,
|
|
|
|
ID3D11CommandList** ppCommandList);
|
2018-01-23 08:23:31 +00:00
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE Map(
|
|
|
|
ID3D11Resource* pResource,
|
|
|
|
UINT Subresource,
|
|
|
|
D3D11_MAP MapType,
|
|
|
|
UINT MapFlags,
|
2018-10-17 15:52:46 +01:00
|
|
|
D3D11_MAPPED_SUBRESOURCE* pMappedResource);
|
2018-01-23 08:23:31 +00:00
|
|
|
|
|
|
|
void STDMETHODCALLTYPE Unmap(
|
|
|
|
ID3D11Resource* pResource,
|
2018-10-17 15:52:46 +01:00
|
|
|
UINT Subresource);
|
2018-01-23 08:23:31 +00:00
|
|
|
|
2019-05-03 15:41:44 +01:00
|
|
|
void STDMETHODCALLTYPE SwapDeviceContextState(
|
|
|
|
ID3DDeviceContextState* pState,
|
|
|
|
ID3DDeviceContextState** ppPreviousState);
|
|
|
|
|
2022-08-24 11:14:43 +01:00
|
|
|
D3D10DeviceLock LockContext() {
|
|
|
|
return D3D10DeviceLock();
|
|
|
|
}
|
|
|
|
|
2018-01-23 08:23:31 +00:00
|
|
|
private:
|
|
|
|
|
2018-03-19 02:19:13 +00:00
|
|
|
// Command list that we're recording
|
2018-01-23 11:03:26 +00:00
|
|
|
Com<D3D11CommandList> m_commandList;
|
|
|
|
|
2018-03-19 02:19:13 +00:00
|
|
|
// Info about currently mapped (sub)resources. Using a vector
|
|
|
|
// here is reasonable since there will usually only be a small
|
|
|
|
// number of mapped resources per command list.
|
|
|
|
std::vector<D3D11DeferredContextMapEntry> m_mappedResources;
|
|
|
|
|
2019-11-02 12:06:44 +00:00
|
|
|
// Begun and ended queries, will also be stored in command list
|
|
|
|
std::vector<Com<D3D11Query, false>> m_queriesBegun;
|
|
|
|
|
2023-01-17 11:33:19 +00:00
|
|
|
// Chunk ID within the current command list
|
|
|
|
uint64_t m_chunkId = 0ull;
|
|
|
|
|
2018-03-19 02:19:13 +00:00
|
|
|
HRESULT MapBuffer(
|
2018-03-25 12:24:03 +01:00
|
|
|
ID3D11Resource* pResource,
|
2022-02-10 13:23:53 +00:00
|
|
|
D3D11_MAPPED_SUBRESOURCE* pMappedResource);
|
2018-03-19 02:19:13 +00:00
|
|
|
|
|
|
|
HRESULT MapImage(
|
2018-03-25 12:24:03 +01:00
|
|
|
ID3D11Resource* pResource,
|
|
|
|
UINT Subresource,
|
2022-02-10 13:23:53 +00:00
|
|
|
D3D11_MAPPED_SUBRESOURCE* pMappedResource);
|
2022-02-06 17:20:31 +00:00
|
|
|
|
|
|
|
void UpdateMappedBuffer(
|
|
|
|
D3D11Buffer* pDstBuffer,
|
|
|
|
UINT Offset,
|
|
|
|
UINT Length,
|
|
|
|
const void* pSrcData,
|
|
|
|
UINT CopyFlags);
|
|
|
|
|
2019-11-02 12:06:44 +00:00
|
|
|
void FinalizeQueries();
|
|
|
|
|
2018-01-23 11:03:26 +00:00
|
|
|
Com<D3D11CommandList> CreateCommandList();
|
|
|
|
|
2019-05-19 12:21:08 +01:00
|
|
|
void EmitCsChunk(DxvkCsChunkRef&& chunk);
|
2018-11-20 09:44:04 +00:00
|
|
|
|
2023-01-17 11:33:19 +00:00
|
|
|
uint64_t GetCurrentChunkId() const;
|
|
|
|
|
2022-02-09 01:54:32 +00:00
|
|
|
void TrackTextureSequenceNumber(
|
2022-02-10 13:23:53 +00:00
|
|
|
D3D11CommonTexture* pResource,
|
|
|
|
UINT Subresource);
|
2022-02-09 01:54:32 +00:00
|
|
|
|
|
|
|
void TrackBufferSequenceNumber(
|
2022-02-10 13:23:53 +00:00
|
|
|
D3D11Buffer* pResource);
|
|
|
|
|
|
|
|
D3D11DeferredContextMapEntry* FindMapEntry(
|
|
|
|
ID3D11Resource* pResource,
|
|
|
|
UINT Subresource);
|
|
|
|
|
|
|
|
void AddMapEntry(
|
|
|
|
ID3D11Resource* pResource,
|
|
|
|
UINT Subresource,
|
|
|
|
D3D11_RESOURCE_DIMENSION ResourceType,
|
|
|
|
const D3D11_MAPPED_SUBRESOURCE& MapInfo);
|
2022-02-09 01:54:32 +00:00
|
|
|
|
2018-11-20 09:44:04 +00:00
|
|
|
static DxvkCsChunkFlags GetCsChunkFlags(
|
|
|
|
D3D11Device* pDevice);
|
2018-01-23 08:23:31 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2018-03-19 10:49:48 +00:00
|
|
|
}
|