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:
parent
c61200d35f
commit
ad5688764c
@ -10,11 +10,13 @@
|
||||
namespace dxvk {
|
||||
|
||||
D3D11DeviceContext::D3D11DeviceContext(
|
||||
D3D11Device* pParent,
|
||||
const Rc<DxvkDevice>& Device)
|
||||
D3D11Device* pParent,
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,8 +18,9 @@ namespace dxvk {
|
||||
public:
|
||||
|
||||
D3D11DeviceContext(
|
||||
D3D11Device* pParent,
|
||||
const Rc<DxvkDevice>& Device);
|
||||
D3D11Device* pParent,
|
||||
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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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) {
|
||||
|
@ -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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user