2018-01-23 09:23:31 +01:00
|
|
|
#include "d3d11_context_def.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
D3D11DeferredContext::D3D11DeferredContext(
|
|
|
|
D3D11Device* pParent,
|
|
|
|
Rc<DxvkDevice> Device,
|
|
|
|
UINT ContextFlags)
|
|
|
|
: D3D11DeviceContext(pParent, Device),
|
2018-01-23 12:03:26 +01:00
|
|
|
m_contextFlags(ContextFlags),
|
|
|
|
m_commandList (CreateCommandList()) {
|
2018-03-03 20:59:17 +01:00
|
|
|
ClearState();
|
2018-01-23 09:23:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE D3D11DeferredContext::GetType() {
|
|
|
|
return D3D11_DEVICE_CONTEXT_DEFERRED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UINT STDMETHODCALLTYPE D3D11DeferredContext::GetContextFlags() {
|
|
|
|
return m_contextFlags;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE D3D11DeferredContext::Flush() {
|
|
|
|
Logger::err("D3D11: Flush called on a deferred context");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE D3D11DeferredContext::ExecuteCommandList(
|
|
|
|
ID3D11CommandList* pCommandList,
|
2018-03-06 18:34:34 +01:00
|
|
|
BOOL RestoreContextState) {
|
2018-03-12 23:36:55 +01:00
|
|
|
FlushCsChunk();
|
|
|
|
|
2018-03-03 20:59:17 +01:00
|
|
|
static_cast<D3D11CommandList*>(pCommandList)->EmitToCommandList(m_commandList.ptr());
|
|
|
|
|
|
|
|
if (RestoreContextState)
|
|
|
|
RestoreState();
|
|
|
|
else
|
|
|
|
ClearState();
|
2018-01-23 09:23:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE D3D11DeferredContext::FinishCommandList(
|
2018-03-06 18:34:34 +01:00
|
|
|
BOOL RestoreDeferredContextState,
|
2018-01-23 09:23:31 +01:00
|
|
|
ID3D11CommandList **ppCommandList) {
|
2018-03-12 23:36:55 +01:00
|
|
|
FlushCsChunk();
|
|
|
|
|
2018-03-03 22:28:30 +01:00
|
|
|
if (ppCommandList != nullptr)
|
|
|
|
*ppCommandList = m_commandList.ref();
|
2018-03-03 20:59:17 +01:00
|
|
|
m_commandList = CreateCommandList();
|
|
|
|
|
2018-03-10 14:41:06 +01:00
|
|
|
if (RestoreDeferredContextState)
|
2018-03-03 22:28:30 +01:00
|
|
|
RestoreState();
|
2018-03-10 14:41:06 +01:00
|
|
|
else
|
|
|
|
ClearState();
|
2018-03-03 20:59:17 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2018-01-23 09:23:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE D3D11DeferredContext::Map(
|
|
|
|
ID3D11Resource* pResource,
|
|
|
|
UINT Subresource,
|
|
|
|
D3D11_MAP MapType,
|
|
|
|
UINT MapFlags,
|
|
|
|
D3D11_MAPPED_SUBRESOURCE* pMappedResource) {
|
|
|
|
Logger::err("D3D11DeferredContext::Map: Not implemented");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE D3D11DeferredContext::Unmap(
|
|
|
|
ID3D11Resource* pResource,
|
|
|
|
UINT Subresource) {
|
|
|
|
Logger::err("D3D11DeferredContext::Unmap: Not implemented");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-01-23 12:03:26 +01:00
|
|
|
Com<D3D11CommandList> D3D11DeferredContext::CreateCommandList() {
|
|
|
|
return new D3D11CommandList(m_parent, m_contextFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void D3D11DeferredContext::EmitCsChunk(Rc<DxvkCsChunk>&& chunk) {
|
|
|
|
m_commandList->AddChunk(std::move(chunk));
|
2018-01-23 09:23:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|