1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-27 04:54:15 +01:00

[dxvk] Add method to retrieve resource debug names

This commit is contained in:
Philip Rebohle 2025-02-24 23:38:03 +01:00
parent 9c395fd60d
commit a0c8bbaf10
11 changed files with 50 additions and 12 deletions

View File

@ -1126,7 +1126,7 @@ namespace dxvk {
] (DxvkContext* ctx) {
ctx->signal(cSubmissionFence, cSubmissionId);
ctx->signal(cStagingFence, cStagingMemory);
ctx->flushCommandList(cSubmissionStatus);
ctx->flushCommandList(nullptr, cSubmissionStatus);
});
FlushCsChunk();

View File

@ -337,7 +337,7 @@ namespace dxvk {
cSignalValue = stats.allocatedTotal
] (DxvkContext* ctx) {
ctx->signal(cSignal, cSignalValue);
ctx->flushCommandList(nullptr);
ctx->flushCommandList(nullptr, nullptr);
});
FlushCsChunk();

View File

@ -445,7 +445,7 @@ namespace dxvk {
// Submit current command list and present
ctx->synchronizeWsi(cSync);
ctx->flushCommandList(nullptr);
ctx->flushCommandList(nullptr, nullptr);
cDevice->presentImage(cPresenter, cLatency, cFrameId, nullptr);
});

View File

@ -6102,7 +6102,7 @@ namespace dxvk {
] (DxvkContext* ctx) {
ctx->signal(cSubmissionFence, cSubmissionId);
ctx->signal(cStagingBufferFence, cStagingBufferAllocated);
ctx->flushCommandList(cSubmissionStatus);
ctx->flushCommandList(nullptr, cSubmissionStatus);
});
FlushCsChunk();

View File

@ -162,7 +162,7 @@ namespace dxvk {
void D3D9Initializer::ExecuteFlushLocked() {
EmitCs([] (DxvkContext* ctx) {
ctx->flushCommandList(nullptr);
ctx->flushCommandList(nullptr, nullptr);
});
FlushCsChunk();

View File

@ -892,7 +892,7 @@ namespace dxvk {
// Submit command list and present
ctx->synchronizeWsi(cSync);
ctx->flushCommandList(nullptr);
ctx->flushCommandList(nullptr, nullptr);
uint64_t frameId = cRepeat ? 0 : cFrameId;

View File

@ -418,6 +418,14 @@ namespace dxvk {
*/
void setDebugName(const char* name);
/**
* \brief Retrieves debug name
* \returns Debug name
*/
const char* getDebugName() const {
return m_debugName.c_str();
}
private:
Rc<vk::DeviceFn> m_vkd;
@ -684,4 +692,4 @@ namespace dxvk {
m_buffer->decRef();
}
}
}

View File

@ -76,7 +76,8 @@ namespace dxvk {
}
Rc<DxvkCommandList> DxvkContext::endRecording() {
Rc<DxvkCommandList> DxvkContext::endRecording(
const VkDebugUtilsLabelEXT* reason) {
this->endCurrentCommands();
this->relocateQueuedResources();
@ -85,6 +86,12 @@ namespace dxvk {
m_descriptorPool = m_descriptorManager->getDescriptorPool();
}
if (unlikely(m_features.test(DxvkContextFeature::DebugUtils))) {
// Make sure to emit the submission reason always at the very end
if (reason && reason->pLabelName && reason->pLabelName[0])
m_cmd->cmdInsertDebugUtilsLabel(DxvkCmdBuffer::ExecBuffer, *reason);
}
m_cmd->finalize();
return std::exchange(m_cmd, nullptr);
}
@ -121,13 +128,15 @@ namespace dxvk {
}
void DxvkContext::flushCommandList(DxvkSubmitStatus* status) {
void DxvkContext::flushCommandList(
const VkDebugUtilsLabelEXT* reason,
DxvkSubmitStatus* status) {
// Need to call this before submitting so that the last GPU
// submission does not happen before the render end signal.
if (m_endLatencyTracking && m_latencyTracker)
m_latencyTracker->notifyCsRenderEnd(m_latencyFrameId);
m_device->submitCommandList(this->endRecording(),
m_device->submitCommandList(this->endRecording(reason),
m_latencyTracker, m_latencyFrameId, status);
// Ensure that subsequent submissions do not see the tracker.

View File

@ -59,9 +59,11 @@ namespace dxvk {
*
* This will not change any context state
* other than the active command list.
* \param [in] reason Optional debug label describing the reason
* \returns Active command list
*/
Rc<DxvkCommandList> endRecording();
Rc<DxvkCommandList> endRecording(
const VkDebugUtilsLabelEXT* reason);
/**
* \brief Ends frame
@ -100,9 +102,12 @@ namespace dxvk {
*
* Transparently submits the current command
* buffer and allocates a new one.
* \param [in] reason Optional debug label describing the reason
* \param [out] status Submission feedback
*/
void flushCommandList(DxvkSubmitStatus* status);
void flushCommandList(
const VkDebugUtilsLabelEXT* reason,
DxvkSubmitStatus* status);
/**
* \brief Synchronizes command list with WSI

View File

@ -616,6 +616,14 @@ namespace dxvk {
*/
void setDebugName(const char* name);
/**
* \brief Retrieves debug name
* \returns Debug name
*/
const char* getDebugName() const {
return m_debugName.c_str();
}
private:
Rc<vk::DeviceFn> m_vkd;

View File

@ -637,6 +637,14 @@ namespace dxvk {
*/
virtual void setDebugName(const char* name) = 0;
/**
* \brief Retrieves debug name
*
* May return an empty string if debug support is disabled.
* \returns The resource debug name
*/
virtual const char* getDebugName() const = 0;
private:
std::atomic<uint64_t> m_useCount = { 0u };