2018-01-23 09:23:31 +01:00
|
|
|
#include "d3d11_cmdlist.h"
|
|
|
|
#include "d3d11_device.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
D3D11CommandList::D3D11CommandList(
|
|
|
|
D3D11Device* pDevice,
|
|
|
|
UINT ContextFlags)
|
|
|
|
: m_device (pDevice),
|
|
|
|
m_contextFlags(ContextFlags) { }
|
|
|
|
|
|
|
|
|
|
|
|
D3D11CommandList::~D3D11CommandList() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE D3D11CommandList::QueryInterface(REFIID riid, void** ppvObject) {
|
2018-04-02 12:52:02 +02:00
|
|
|
*ppvObject = nullptr;
|
|
|
|
|
|
|
|
if (riid == __uuidof(IUnknown)
|
|
|
|
|| riid == __uuidof(ID3D11DeviceChild)
|
|
|
|
|| riid == __uuidof(ID3D11CommandList)) {
|
|
|
|
*ppvObject = ref(this);
|
|
|
|
return S_OK;
|
|
|
|
}
|
2018-01-23 09:23:31 +01:00
|
|
|
|
|
|
|
Logger::warn("D3D11CommandList::QueryInterface: Unknown interface query");
|
2018-03-12 12:05:43 +01:00
|
|
|
Logger::warn(str::format(riid));
|
2018-01-23 09:23:31 +01:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE D3D11CommandList::GetDevice(ID3D11Device **ppDevice) {
|
|
|
|
*ppDevice = ref(m_device);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-01-23 12:16:28 +01:00
|
|
|
UINT STDMETHODCALLTYPE D3D11CommandList::GetContextFlags() {
|
2018-01-23 09:23:31 +01:00
|
|
|
return m_contextFlags;
|
|
|
|
}
|
|
|
|
|
2018-01-23 12:03:26 +01:00
|
|
|
|
2018-08-27 16:07:38 +02:00
|
|
|
void D3D11CommandList::AddChunk(DxvkCsChunkRef&& Chunk) {
|
2018-01-23 12:03:26 +01:00
|
|
|
m_chunks.push_back(std::move(Chunk));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void D3D11CommandList::EmitToCommandList(ID3D11CommandList* pCommandList) {
|
|
|
|
auto cmdList = static_cast<D3D11CommandList*>(pCommandList);
|
|
|
|
|
2018-04-28 01:14:57 +02:00
|
|
|
for (const auto& chunk : m_chunks)
|
2018-01-23 12:03:26 +01:00
|
|
|
cmdList->m_chunks.push_back(chunk);
|
2018-06-29 12:44:52 +02:00
|
|
|
|
|
|
|
MarkSubmitted();
|
2018-01-23 12:03:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-03 20:59:17 +01:00
|
|
|
void D3D11CommandList::EmitToCsThread(DxvkCsThread* CsThread) {
|
2018-04-28 01:14:57 +02:00
|
|
|
for (const auto& chunk : m_chunks)
|
2018-08-27 16:07:38 +02:00
|
|
|
CsThread->dispatchChunk(DxvkCsChunkRef(chunk));
|
2018-06-29 12:44:52 +02:00
|
|
|
|
|
|
|
MarkSubmitted();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void D3D11CommandList::MarkSubmitted() {
|
2018-10-09 16:29:50 +02:00
|
|
|
if (m_submitted.exchange(true) && !m_warned.exchange(true)
|
|
|
|
&& m_device->GetOptions()->dcMapSpeedHack) {
|
2018-06-29 12:44:52 +02:00
|
|
|
Logger::warn(
|
2018-10-09 16:29:50 +02:00
|
|
|
"D3D11: Command list submitted multiple times,\n"
|
|
|
|
" but d3d11.dcMapSpeedHack is enabled");
|
2018-06-29 12:44:52 +02:00
|
|
|
}
|
2018-01-23 12:03:26 +01:00
|
|
|
}
|
|
|
|
|
2018-01-23 09:23:31 +01:00
|
|
|
}
|