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 {
|
namespace dxvk {
|
||||||
|
|
||||||
D3D11DeviceContext::D3D11DeviceContext(
|
D3D11DeviceContext::D3D11DeviceContext(
|
||||||
D3D11Device* pParent,
|
D3D11Device* pParent,
|
||||||
const Rc<DxvkDevice>& Device)
|
const Rc<DxvkDevice>& Device,
|
||||||
|
DxvkCsChunkFlags CsFlags)
|
||||||
: m_parent (pParent),
|
: m_parent (pParent),
|
||||||
m_annotation(this),
|
m_annotation(this),
|
||||||
m_device (Device),
|
m_device (Device),
|
||||||
|
m_csFlags (CsFlags),
|
||||||
m_csChunk (AllocCsChunk()) {
|
m_csChunk (AllocCsChunk()) {
|
||||||
// Create default state objects. We won't ever return them
|
// Create default state objects. We won't ever return them
|
||||||
// to the application, but we'll use them to apply state.
|
// to the application, but we'll use them to apply state.
|
||||||
@ -3350,7 +3352,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
DxvkCsChunkRef D3D11DeviceContext::AllocCsChunk() {
|
DxvkCsChunkRef D3D11DeviceContext::AllocCsChunk() {
|
||||||
return m_parent->AllocCsChunk(0);
|
return m_parent->AllocCsChunk(m_csFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,9 @@ namespace dxvk {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
D3D11DeviceContext(
|
D3D11DeviceContext(
|
||||||
D3D11Device* pParent,
|
D3D11Device* pParent,
|
||||||
const Rc<DxvkDevice>& Device);
|
const Rc<DxvkDevice>& Device,
|
||||||
|
DxvkCsChunkFlags CsFlags);
|
||||||
~D3D11DeviceContext();
|
~D3D11DeviceContext();
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QueryInterface(
|
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||||
@ -650,6 +651,7 @@ namespace dxvk {
|
|||||||
Rc<DxvkDevice> m_device;
|
Rc<DxvkDevice> m_device;
|
||||||
Rc<DxvkDataBuffer> m_updateBuffer;
|
Rc<DxvkDataBuffer> m_updateBuffer;
|
||||||
|
|
||||||
|
DxvkCsChunkFlags m_csFlags;
|
||||||
DxvkCsChunkRef m_csChunk;
|
DxvkCsChunkRef m_csChunk;
|
||||||
|
|
||||||
Com<D3D11BlendState> m_defaultBlendState;
|
Com<D3D11BlendState> m_defaultBlendState;
|
||||||
|
@ -7,7 +7,7 @@ namespace dxvk {
|
|||||||
D3D11Device* pParent,
|
D3D11Device* pParent,
|
||||||
const Rc<DxvkDevice>& Device,
|
const Rc<DxvkDevice>& Device,
|
||||||
UINT ContextFlags)
|
UINT ContextFlags)
|
||||||
: D3D11DeviceContext(pParent, Device),
|
: D3D11DeviceContext(pParent, Device, GetCsChunkFlags(pParent)),
|
||||||
m_contextFlags(ContextFlags),
|
m_contextFlags(ContextFlags),
|
||||||
m_commandList (CreateCommandList()) {
|
m_commandList (CreateCommandList()) {
|
||||||
ClearState();
|
ClearState();
|
||||||
@ -298,4 +298,12 @@ namespace dxvk {
|
|||||||
m_commandList->AddChunk(std::move(chunk));
|
m_commandList->AddChunk(std::move(chunk));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DxvkCsChunkFlags D3D11DeferredContext::GetCsChunkFlags(
|
||||||
|
D3D11Device* pDevice) {
|
||||||
|
return pDevice->GetOptions()->dcMapSpeedHack
|
||||||
|
? DxvkCsChunkFlags(DxvkCsChunkFlag::SingleUse)
|
||||||
|
: DxvkCsChunkFlags();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -98,6 +98,9 @@ namespace dxvk {
|
|||||||
Com<D3D11CommandList> CreateCommandList();
|
Com<D3D11CommandList> CreateCommandList();
|
||||||
|
|
||||||
void EmitCsChunk(DxvkCsChunkRef&& chunk);
|
void EmitCsChunk(DxvkCsChunkRef&& chunk);
|
||||||
|
|
||||||
|
static DxvkCsChunkFlags GetCsChunkFlags(
|
||||||
|
D3D11Device* pDevice);
|
||||||
|
|
||||||
auto FindMapEntry(ID3D11Resource* pResource, UINT Subresource) {
|
auto FindMapEntry(ID3D11Resource* pResource, UINT Subresource) {
|
||||||
return std::find_if(m_mappedResources.rbegin(), m_mappedResources.rend(),
|
return std::find_if(m_mappedResources.rbegin(), m_mappedResources.rend(),
|
||||||
|
@ -11,7 +11,7 @@ namespace dxvk {
|
|||||||
D3D11ImmediateContext::D3D11ImmediateContext(
|
D3D11ImmediateContext::D3D11ImmediateContext(
|
||||||
D3D11Device* pParent,
|
D3D11Device* pParent,
|
||||||
const Rc<DxvkDevice>& Device)
|
const Rc<DxvkDevice>& Device)
|
||||||
: D3D11DeviceContext(pParent, Device),
|
: D3D11DeviceContext(pParent, Device, DxvkCsChunkFlag::SingleUse),
|
||||||
m_csThread(Device->createContext()) {
|
m_csThread(Device->createContext()) {
|
||||||
EmitCs([cDevice = m_device] (DxvkContext* ctx) {
|
EmitCs([cDevice = m_device] (DxvkContext* ctx) {
|
||||||
ctx->beginRecording(cDevice->createCommandList());
|
ctx->beginRecording(cDevice->createCommandList());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user