1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 20:52:10 +01:00

[d3d11] Use single-use submission mode for CS chunks where possible

This commit is contained in:
Philip Rebohle 2018-11-20 10:44:04 +01:00
parent c61200d35f
commit ad5688764c
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
5 changed files with 22 additions and 7 deletions

View File

@ -11,10 +11,12 @@ namespace dxvk {
D3D11DeviceContext::D3D11DeviceContext(
D3D11Device* pParent,
const Rc<DxvkDevice>& Device)
const Rc<DxvkDevice>& Device,
DxvkCsChunkFlags CsFlags)
: m_parent (pParent),
m_annotation(this),
m_device (Device),
m_csFlags (CsFlags),
m_csChunk (AllocCsChunk()) {
// Create default state objects. We won't ever return them
// to the application, but we'll use them to apply state.
@ -3350,7 +3352,7 @@ namespace dxvk {
DxvkCsChunkRef D3D11DeviceContext::AllocCsChunk() {
return m_parent->AllocCsChunk(0);
return m_parent->AllocCsChunk(m_csFlags);
}
}

View File

@ -19,7 +19,8 @@ namespace dxvk {
D3D11DeviceContext(
D3D11Device* pParent,
const Rc<DxvkDevice>& Device);
const Rc<DxvkDevice>& Device,
DxvkCsChunkFlags CsFlags);
~D3D11DeviceContext();
HRESULT STDMETHODCALLTYPE QueryInterface(
@ -650,6 +651,7 @@ namespace dxvk {
Rc<DxvkDevice> m_device;
Rc<DxvkDataBuffer> m_updateBuffer;
DxvkCsChunkFlags m_csFlags;
DxvkCsChunkRef m_csChunk;
Com<D3D11BlendState> m_defaultBlendState;

View File

@ -7,7 +7,7 @@ namespace dxvk {
D3D11Device* pParent,
const Rc<DxvkDevice>& Device,
UINT ContextFlags)
: D3D11DeviceContext(pParent, Device),
: D3D11DeviceContext(pParent, Device, GetCsChunkFlags(pParent)),
m_contextFlags(ContextFlags),
m_commandList (CreateCommandList()) {
ClearState();
@ -298,4 +298,12 @@ namespace dxvk {
m_commandList->AddChunk(std::move(chunk));
}
DxvkCsChunkFlags D3D11DeferredContext::GetCsChunkFlags(
D3D11Device* pDevice) {
return pDevice->GetOptions()->dcMapSpeedHack
? DxvkCsChunkFlags(DxvkCsChunkFlag::SingleUse)
: DxvkCsChunkFlags();
}
}

View File

@ -99,6 +99,9 @@ namespace dxvk {
void EmitCsChunk(DxvkCsChunkRef&& chunk);
static DxvkCsChunkFlags GetCsChunkFlags(
D3D11Device* pDevice);
auto FindMapEntry(ID3D11Resource* pResource, UINT Subresource) {
return std::find_if(m_mappedResources.rbegin(), m_mappedResources.rend(),
[pResource, Subresource] (const D3D11DeferredContextMapEntry& entry) {

View File

@ -11,7 +11,7 @@ namespace dxvk {
D3D11ImmediateContext::D3D11ImmediateContext(
D3D11Device* pParent,
const Rc<DxvkDevice>& Device)
: D3D11DeviceContext(pParent, Device),
: D3D11DeviceContext(pParent, Device, DxvkCsChunkFlag::SingleUse),
m_csThread(Device->createContext()) {
EmitCs([cDevice = m_device] (DxvkContext* ctx) {
ctx->beginRecording(cDevice->createCommandList());