mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-06 20:58:37 +01:00
[dxvk] Add debug regions to command buffers
This commit is contained in:
parent
c70504bf46
commit
f6bdca7fc1
3 changed files with 45 additions and 5 deletions
|
@ -115,7 +115,7 @@ namespace dxvk {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VkCommandBuffer DxvkCommandPool::getCommandBuffer() {
|
VkCommandBuffer DxvkCommandPool::getCommandBuffer(DxvkCmdBuffer type) {
|
||||||
auto vk = m_device->vkd();
|
auto vk = m_device->vkd();
|
||||||
|
|
||||||
if (m_next == m_commandBuffers.size()) {
|
if (m_next == m_commandBuffers.size()) {
|
||||||
|
@ -143,6 +143,24 @@ namespace dxvk {
|
||||||
if (vk->vkBeginCommandBuffer(commandBuffer, &info))
|
if (vk->vkBeginCommandBuffer(commandBuffer, &info))
|
||||||
throw DxvkError("DxvkCommandPool: Failed to begin command buffer");
|
throw DxvkError("DxvkCommandPool: Failed to begin command buffer");
|
||||||
|
|
||||||
|
if (m_device->isDebugEnabled()) {
|
||||||
|
auto vki = m_device->vki();
|
||||||
|
|
||||||
|
VkDebugUtilsLabelEXT label = { };
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case DxvkCmdBuffer::ExecBuffer: label = vk::makeLabel(0xdcc0a2, "Graphics commands"); break;
|
||||||
|
case DxvkCmdBuffer::InitBuffer: label = vk::makeLabel(0xc0dca2, "Init commands"); break;
|
||||||
|
case DxvkCmdBuffer::InitBarriers: label = vk::makeLabel(0xd0e6b8, "Init barriers"); break;
|
||||||
|
case DxvkCmdBuffer::SdmaBuffer: label = vk::makeLabel(0xc0a2dc, "Upload commands"); break;
|
||||||
|
case DxvkCmdBuffer::SdmaBarriers: label = vk::makeLabel(0xd0b8e6, "Upload barriers"); break;
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (label.pLabelName)
|
||||||
|
vki->vkCmdBeginDebugUtilsLabelEXT(commandBuffer, &label);
|
||||||
|
}
|
||||||
|
|
||||||
return commandBuffer;
|
return commandBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +180,7 @@ namespace dxvk {
|
||||||
DxvkCommandList::DxvkCommandList(DxvkDevice* device)
|
DxvkCommandList::DxvkCommandList(DxvkDevice* device)
|
||||||
: m_device (device),
|
: m_device (device),
|
||||||
m_vkd (device->vkd()),
|
m_vkd (device->vkd()),
|
||||||
m_vki (device->instance()->vki()) {
|
m_vki (device->vki()) {
|
||||||
const auto& graphicsQueue = m_device->queues().graphics;
|
const auto& graphicsQueue = m_device->queues().graphics;
|
||||||
const auto& transferQueue = m_device->queues().transfer;
|
const auto& transferQueue = m_device->queues().transfer;
|
||||||
|
|
||||||
|
@ -409,6 +427,9 @@ namespace dxvk {
|
||||||
void DxvkCommandList::endCommandBuffer(VkCommandBuffer cmdBuffer) {
|
void DxvkCommandList::endCommandBuffer(VkCommandBuffer cmdBuffer) {
|
||||||
auto vk = m_device->vkd();
|
auto vk = m_device->vkd();
|
||||||
|
|
||||||
|
if (m_device->isDebugEnabled())
|
||||||
|
m_vki->vkCmdEndDebugUtilsLabelEXT(cmdBuffer);
|
||||||
|
|
||||||
if (vk->vkEndCommandBuffer(cmdBuffer))
|
if (vk->vkEndCommandBuffer(cmdBuffer))
|
||||||
throw DxvkError("DxvkCommandList: Failed to end command buffer");
|
throw DxvkError("DxvkCommandList: Failed to end command buffer");
|
||||||
}
|
}
|
||||||
|
@ -416,8 +437,8 @@ namespace dxvk {
|
||||||
|
|
||||||
VkCommandBuffer DxvkCommandList::allocateCommandBuffer(DxvkCmdBuffer type) {
|
VkCommandBuffer DxvkCommandList::allocateCommandBuffer(DxvkCmdBuffer type) {
|
||||||
return type == DxvkCmdBuffer::SdmaBuffer || type == DxvkCmdBuffer::SdmaBarriers
|
return type == DxvkCmdBuffer::SdmaBuffer || type == DxvkCmdBuffer::SdmaBarriers
|
||||||
? m_transferPool->getCommandBuffer()
|
? m_transferPool->getCommandBuffer(type)
|
||||||
: m_graphicsPool->getCommandBuffer();
|
: m_graphicsPool->getCommandBuffer(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,9 +172,11 @@ namespace dxvk {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retrieves or allocates a command buffer
|
* \brief Retrieves or allocates a command buffer
|
||||||
|
*
|
||||||
|
* \param [in] type Command buffer type
|
||||||
* \returns New command buffer in begun state
|
* \returns New command buffer in begun state
|
||||||
*/
|
*/
|
||||||
VkCommandBuffer getCommandBuffer();
|
VkCommandBuffer getCommandBuffer(DxvkCmdBuffer type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Resets command pool and all command buffers
|
* \brief Resets command pool and all command buffers
|
||||||
|
|
|
@ -227,6 +227,23 @@ namespace dxvk::vk {
|
||||||
return name && name[0];
|
return name && name[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Makes debug label
|
||||||
|
*
|
||||||
|
* \param [in] color Color, as BGR with implied opaque alpha
|
||||||
|
* \param [in] text Label text
|
||||||
|
*/
|
||||||
|
inline VkDebugUtilsLabelEXT makeLabel(uint32_t color, const char* text) {
|
||||||
|
VkDebugUtilsLabelEXT label = { VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT };
|
||||||
|
label.color[0] = ((color >> 16u) & 0xffu) / 255.0f;
|
||||||
|
label.color[1] = ((color >> 8u) & 0xffu) / 255.0f;
|
||||||
|
label.color[2] = ((color >> 0u) & 0xffu) / 255.0f;
|
||||||
|
label.color[3] = 1.0f;
|
||||||
|
label.pLabelName = text;
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue