[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) { ] (DxvkContext* ctx) {
ctx->signal(cSubmissionFence, cSubmissionId); ctx->signal(cSubmissionFence, cSubmissionId);
ctx->signal(cStagingFence, cStagingMemory); ctx->signal(cStagingFence, cStagingMemory);
ctx->flushCommandList(cSubmissionStatus); ctx->flushCommandList(nullptr, cSubmissionStatus);
}); });
FlushCsChunk(); FlushCsChunk();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -418,6 +418,14 @@ namespace dxvk {
*/ */
void setDebugName(const char* name); void setDebugName(const char* name);
/**
* \brief Retrieves debug name
* \returns Debug name
*/
const char* getDebugName() const {
return m_debugName.c_str();
}
private: private:
Rc<vk::DeviceFn> m_vkd; Rc<vk::DeviceFn> m_vkd;
@ -684,4 +692,4 @@ namespace dxvk {
m_buffer->decRef(); 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->endCurrentCommands();
this->relocateQueuedResources(); this->relocateQueuedResources();
@ -85,6 +86,12 @@ namespace dxvk {
m_descriptorPool = m_descriptorManager->getDescriptorPool(); 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(); m_cmd->finalize();
return std::exchange(m_cmd, nullptr); 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 // Need to call this before submitting so that the last GPU
// submission does not happen before the render end signal. // submission does not happen before the render end signal.
if (m_endLatencyTracking && m_latencyTracker) if (m_endLatencyTracking && m_latencyTracker)
m_latencyTracker->notifyCsRenderEnd(m_latencyFrameId); m_latencyTracker->notifyCsRenderEnd(m_latencyFrameId);
m_device->submitCommandList(this->endRecording(), m_device->submitCommandList(this->endRecording(reason),
m_latencyTracker, m_latencyFrameId, status); m_latencyTracker, m_latencyFrameId, status);
// Ensure that subsequent submissions do not see the tracker. // Ensure that subsequent submissions do not see the tracker.

View file

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

View file

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

View file

@ -637,6 +637,14 @@ namespace dxvk {
*/ */
virtual void setDebugName(const char* name) = 0; 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: private:
std::atomic<uint64_t> m_useCount = { 0u }; std::atomic<uint64_t> m_useCount = { 0u };