[dxvk] Add support for debug utils labels

Reviewed-by: Oleg Kuznetsov <okouznetsov@nvidia.com>
This commit is contained in:
Liam Middlebrook 2021-04-01 02:59:10 -07:00 committed by Philip Rebohle
parent c89b274325
commit 5ce5999232
8 changed files with 87 additions and 8 deletions

View File

@ -110,6 +110,7 @@ The following environment variables can be used for **debugging** purposes.
- `DXVK_LOG_LEVEL=none|error|warn|info|debug` Controls message logging.
- `DXVK_LOG_PATH=/some/directory` Changes path where log files are stored. Set to `none` to disable log file creation entirely, without disabling logging.
- `DXVK_CONFIG_FILE=/xxx/dxvk.conf` Sets path to the configuration file.
- `DXVK_PERF_EVENTS=1` Enables use of the VK_EXT_debug_utils extension for translating performance event markers.
## Troubleshooting
DXVK requires threading support from your mingw-w64 build environment. If you

View File

@ -6,6 +6,7 @@ namespace dxvk {
DxvkCommandList::DxvkCommandList(DxvkDevice* device)
: m_device (device),
m_vkd (device->vkd()),
m_vki (device->instance()->vki()),
m_cmdBuffersUsed(0),
m_descriptorPoolTracker(device) {
const auto& graphicsQueue = m_device->queues().graphics;
@ -206,4 +207,15 @@ namespace dxvk {
return m_vkd->vkQueueSubmit(queue, 1, &submitInfo, fence);
}
}
void DxvkCommandList::cmdBeginDebugUtilsLabel(VkDebugUtilsLabelEXT *pLabelInfo) {
m_vki->vkCmdBeginDebugUtilsLabelEXT(m_execBuffer, pLabelInfo);
}
void DxvkCommandList::cmdEndDebugUtilsLabel() {
m_vki->vkCmdEndDebugUtilsLabelEXT(m_execBuffer);
}
void DxvkCommandList::cmdInsertDebugUtilsLabel(VkDebugUtilsLabelEXT *pLabelInfo) {
m_vki->vkCmdInsertDebugUtilsLabelEXT(m_execBuffer, pLabelInfo);
}
}

View File

@ -762,10 +762,17 @@ namespace dxvk {
pipelineStage, queryPool, query);
}
void cmdBeginDebugUtilsLabel(VkDebugUtilsLabelEXT *pLabelInfo);
void cmdEndDebugUtilsLabel();
void cmdInsertDebugUtilsLabel(VkDebugUtilsLabelEXT *pLabelInfo);
private:
DxvkDevice* m_device;
Rc<vk::DeviceFn> m_vkd;
Rc<vk::InstanceFn> m_vki;
VkFence m_fence;
@ -801,4 +808,4 @@ namespace dxvk {
};
}
}

View File

@ -2485,6 +2485,27 @@ namespace dxvk {
void DxvkContext::trimStagingBuffers() {
m_staging.trim();
}
void DxvkContext::beginDebugLabel(VkDebugUtilsLabelEXT *label) {
if (!m_device->instance()->extensions().extDebugUtils)
return;
m_cmd->cmdBeginDebugUtilsLabel(label);
}
void DxvkContext::endDebugLabel() {
if (!m_device->instance()->extensions().extDebugUtils)
return;
m_cmd->cmdEndDebugUtilsLabel();
}
void DxvkContext::insertDebugLabel(VkDebugUtilsLabelEXT *label) {
if (!m_device->instance()->extensions().extDebugUtils)
return;
m_cmd->cmdInsertDebugUtilsLabel(label);
}
void DxvkContext::blitImageFb(
@ -5026,4 +5047,4 @@ namespace dxvk {
return m_zeroBuffer;
}
}
}

View File

@ -981,7 +981,32 @@ namespace dxvk {
* given context are rare.
*/
void trimStagingBuffers();
/**
* \brief Begins a debug label region
* \param [in] label The debug label
*
* Marks the start of a debug label region. Used by debugging/profiling
* tools to mark different workloads within a frame.
*/
void beginDebugLabel(VkDebugUtilsLabelEXT *label);
/**
* \brief Ends a debug label region
*
* Marks the close of a debug label region. Used by debugging/profiling
* tools to mark different workloads within a frame.
*/
void endDebugLabel();
/**
* \brief Inserts a debug label
* \param [in] label The debug label
*
* Inserts an instantaneous debug label. Used by debugging/profiling
* tools to mark different workloads within a frame.
*/
void insertDebugLabel(VkDebugUtilsLabelEXT *label);
private:
Rc<DxvkDevice> m_device;
@ -1246,4 +1271,4 @@ namespace dxvk {
};
}
}

View File

@ -292,8 +292,9 @@ namespace dxvk {
* used by DXVK if supported by the implementation.
*/
struct DxvkInstanceExtensions {
DxvkExt extDebugUtils = { VK_EXT_DEBUG_UTILS_EXTENSION_NAME, DxvkExtMode::Optional };
DxvkExt khrGetSurfaceCapabilities2 = { VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME, DxvkExtMode::Optional };
DxvkExt khrSurface = { VK_KHR_SURFACE_EXTENSION_NAME, DxvkExtMode::Required };
};
}
}

View File

@ -91,11 +91,17 @@ namespace dxvk {
VkInstance DxvkInstance::createInstance() {
DxvkInstanceExtensions insExtensions;
std::array<DxvkExt*, 2> insExtensionList = {{
std::vector<DxvkExt*> insExtensionList = {{
&insExtensions.khrGetSurfaceCapabilities2,
&insExtensions.khrSurface,
}};
// Hide VK_EXT_debug_utils behind an environment variable. This extension
// adds additional overhead to winevulkan
if (env::getEnvVar("DXVK_PERF_EVENTS") == "1") {
insExtensionList.push_back(&insExtensions.extDebugUtils);
}
DxvkNameSet extensionsEnabled;
DxvkNameSet extensionsAvailable = DxvkNameSet::enumInstanceExtensions(m_vkl);

View File

@ -140,6 +140,12 @@ namespace dxvk::vk {
VULKAN_FN(vkDebugReportMessageEXT);
#endif
#ifdef VK_EXT_debug_utils
VULKAN_FN(vkCmdBeginDebugUtilsLabelEXT);
VULKAN_FN(vkCmdEndDebugUtilsLabelEXT);
VULKAN_FN(vkCmdInsertDebugUtilsLabelEXT);
#endif
#ifdef VK_EXT_full_screen_exclusive
VULKAN_FN(vkGetPhysicalDeviceSurfacePresentModes2EXT);
#endif
@ -343,4 +349,4 @@ namespace dxvk::vk {
#endif
};
}
}