mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-27 13:54:16 +01:00
[d3d11] Add debug labels for submissions
This commit is contained in:
parent
a0c8bbaf10
commit
dafb71b18e
@ -97,6 +97,10 @@ namespace dxvk {
|
|||||||
// Ignore the DONOTFLUSH flag here as some games will spin
|
// Ignore the DONOTFLUSH flag here as some games will spin
|
||||||
// on queries without ever flushing the context otherwise.
|
// on queries without ever flushing the context otherwise.
|
||||||
D3D10DeviceLock lock = LockContext();
|
D3D10DeviceLock lock = LockContext();
|
||||||
|
|
||||||
|
if (unlikely(m_device->isDebugEnabled()))
|
||||||
|
m_flushReason = "Query read-back";
|
||||||
|
|
||||||
ConsiderFlush(GpuFlushType::ImplicitSynchronization);
|
ConsiderFlush(GpuFlushType::ImplicitSynchronization);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,6 +160,9 @@ namespace dxvk {
|
|||||||
void STDMETHODCALLTYPE D3D11ImmediateContext::Flush() {
|
void STDMETHODCALLTYPE D3D11ImmediateContext::Flush() {
|
||||||
D3D10DeviceLock lock = LockContext();
|
D3D10DeviceLock lock = LockContext();
|
||||||
|
|
||||||
|
if (unlikely(m_device->isDebugEnabled()))
|
||||||
|
m_flushReason = "Explicit Flush";
|
||||||
|
|
||||||
ExecuteFlush(GpuFlushType::ExplicitFlush, nullptr, true);
|
ExecuteFlush(GpuFlushType::ExplicitFlush, nullptr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,6 +172,9 @@ namespace dxvk {
|
|||||||
HANDLE hEvent) {
|
HANDLE hEvent) {
|
||||||
D3D10DeviceLock lock = LockContext();
|
D3D10DeviceLock lock = LockContext();
|
||||||
|
|
||||||
|
if (unlikely(m_device->isDebugEnabled()))
|
||||||
|
m_flushReason = "Explicit Flush";
|
||||||
|
|
||||||
ExecuteFlush(GpuFlushType::ExplicitFlush, hEvent, true);
|
ExecuteFlush(GpuFlushType::ExplicitFlush, hEvent, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,6 +195,9 @@ namespace dxvk {
|
|||||||
ctx->signalFence(cFence, cValue);
|
ctx->signalFence(cFence, cValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (unlikely(m_device->isDebugEnabled()))
|
||||||
|
m_flushReason = "Fence signal";
|
||||||
|
|
||||||
ExecuteFlush(GpuFlushType::ExplicitFlush, nullptr, true);
|
ExecuteFlush(GpuFlushType::ExplicitFlush, nullptr, true);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -199,6 +212,9 @@ namespace dxvk {
|
|||||||
if (!fence)
|
if (!fence)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
if (unlikely(m_device->isDebugEnabled()))
|
||||||
|
m_flushReason = "Fence wait";
|
||||||
|
|
||||||
ExecuteFlush(GpuFlushType::ExplicitFlush, nullptr, true);
|
ExecuteFlush(GpuFlushType::ExplicitFlush, nullptr, true);
|
||||||
|
|
||||||
EmitCs([
|
EmitCs([
|
||||||
@ -903,33 +919,34 @@ namespace dxvk {
|
|||||||
// Wait for any CS chunk using the resource to execute, since
|
// Wait for any CS chunk using the resource to execute, since
|
||||||
// otherwise we cannot accurately determine if the resource is
|
// otherwise we cannot accurately determine if the resource is
|
||||||
// actually being used by the GPU right now.
|
// actually being used by the GPU right now.
|
||||||
bool isInUse = Resource.isInUse(access);
|
if (!Resource.isInUse(access)) {
|
||||||
|
|
||||||
if (!isInUse) {
|
|
||||||
SynchronizeCsThread(SequenceNumber);
|
SynchronizeCsThread(SequenceNumber);
|
||||||
isInUse = Resource.isInUse(access);
|
|
||||||
|
if (!Resource.isInUse(access))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unlikely(m_device->isDebugEnabled())) {
|
||||||
|
m_flushReason = str::format("Map ", Resource.getDebugName(), " (MAP",
|
||||||
|
MapType != D3D11_MAP_WRITE ? "_READ" : "",
|
||||||
|
MapType != D3D11_MAP_READ ? "_WRITE" : "", ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MapFlags & D3D11_MAP_FLAG_DO_NOT_WAIT) {
|
if (MapFlags & D3D11_MAP_FLAG_DO_NOT_WAIT) {
|
||||||
if (isInUse) {
|
// We don't have to wait, but misbehaving games may
|
||||||
// We don't have to wait, but misbehaving games may
|
// still try to spin on `Map` until the resource is
|
||||||
// still try to spin on `Map` until the resource is
|
// idle, so we should flush pending commands
|
||||||
// idle, so we should flush pending commands
|
ConsiderFlush(GpuFlushType::ImplicitSynchronization);
|
||||||
ConsiderFlush(GpuFlushType::ImplicitSynchronization);
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (isInUse) {
|
// Make sure pending commands using the resource get
|
||||||
// Make sure pending commands using the resource get
|
// executed on the the GPU if we have to wait for it
|
||||||
// executed on the the GPU if we have to wait for it
|
ExecuteFlush(GpuFlushType::ImplicitSynchronization, nullptr, false);
|
||||||
ExecuteFlush(GpuFlushType::ImplicitSynchronization, nullptr, false);
|
SynchronizeCsThread(SequenceNumber);
|
||||||
SynchronizeCsThread(SequenceNumber);
|
|
||||||
|
|
||||||
m_device->waitForResource(Resource, access);
|
m_device->waitForResource(Resource, access);
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1122,11 +1139,14 @@ namespace dxvk {
|
|||||||
cSubmissionId = submissionId,
|
cSubmissionId = submissionId,
|
||||||
cSubmissionStatus = synchronizeSubmission ? &m_submitStatus : nullptr,
|
cSubmissionStatus = synchronizeSubmission ? &m_submitStatus : nullptr,
|
||||||
cStagingFence = m_stagingBufferFence,
|
cStagingFence = m_stagingBufferFence,
|
||||||
cStagingMemory = GetStagingMemoryStatistics().allocatedTotal
|
cStagingMemory = GetStagingMemoryStatistics().allocatedTotal,
|
||||||
|
cFlushReason = std::exchange(m_flushReason, std::string())
|
||||||
] (DxvkContext* ctx) {
|
] (DxvkContext* ctx) {
|
||||||
|
auto debugLabel = vk::makeLabel(0xc0a2f0, cFlushReason.c_str());
|
||||||
|
|
||||||
ctx->signal(cSubmissionFence, cSubmissionId);
|
ctx->signal(cSubmissionFence, cSubmissionId);
|
||||||
ctx->signal(cStagingFence, cStagingMemory);
|
ctx->signal(cStagingFence, cStagingMemory);
|
||||||
ctx->flushCommandList(nullptr, cSubmissionStatus);
|
ctx->flushCommandList(&debugLabel, cSubmissionStatus);
|
||||||
});
|
});
|
||||||
|
|
||||||
FlushCsChunk();
|
FlushCsChunk();
|
||||||
|
@ -138,6 +138,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
Com<D3D11DeviceContextState, false> m_stateObject;
|
Com<D3D11DeviceContextState, false> m_stateObject;
|
||||||
|
|
||||||
|
std::string m_flushReason;
|
||||||
|
|
||||||
HRESULT MapBuffer(
|
HRESULT MapBuffer(
|
||||||
D3D11Buffer* pResource,
|
D3D11Buffer* pResource,
|
||||||
D3D11_MAP MapType,
|
D3D11_MAP MapType,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user