Commit 12a36dd9 by Jamie Madill Committed by Commit Bot

Vulkan: Add debug utils functions to wrapper.

Also adds a more consistent way of checking if the debug utils extension is enabled. Enables adding support for the debug utils markers with the command graph disabled. Bug: angleproject:4029 Change-Id: I5f8762921b06f54e400c25764012ab70e10bfb8d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2055554Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent bb7534ee
...@@ -722,33 +722,31 @@ angle::Result CommandGraphNode::visitAndExecute(vk::Context *context, ...@@ -722,33 +722,31 @@ angle::Result CommandGraphNode::visitAndExecute(vk::Context *context,
case CommandGraphNodeFunction::InsertDebugMarker: case CommandGraphNodeFunction::InsertDebugMarker:
ASSERT(!mOutsideRenderPassCommands.valid() && !mInsideRenderPassCommands.valid()); ASSERT(!mOutsideRenderPassCommands.valid() && !mInsideRenderPassCommands.valid());
if (vkCmdInsertDebugUtilsLabelEXT) if (context->getRenderer()->enableDebugUtils())
{ {
VkDebugUtilsLabelEXT label; VkDebugUtilsLabelEXT label;
MakeDebugUtilsLabel(mDebugMarkerSource, mDebugMarker.c_str(), &label); MakeDebugUtilsLabel(mDebugMarkerSource, mDebugMarker.c_str(), &label);
primaryCommandBuffer->insertDebugUtilsLabelEXT(label);
vkCmdInsertDebugUtilsLabelEXT(primaryCommandBuffer->getHandle(), &label);
} }
break; break;
case CommandGraphNodeFunction::PushDebugMarker: case CommandGraphNodeFunction::PushDebugMarker:
ASSERT(!mOutsideRenderPassCommands.valid() && !mInsideRenderPassCommands.valid()); ASSERT(!mOutsideRenderPassCommands.valid() && !mInsideRenderPassCommands.valid());
if (vkCmdBeginDebugUtilsLabelEXT) if (context->getRenderer()->enableDebugUtils())
{ {
VkDebugUtilsLabelEXT label; VkDebugUtilsLabelEXT label;
MakeDebugUtilsLabel(mDebugMarkerSource, mDebugMarker.c_str(), &label); MakeDebugUtilsLabel(mDebugMarkerSource, mDebugMarker.c_str(), &label);
primaryCommandBuffer->beginDebugUtilsLabelEXT(label);
vkCmdBeginDebugUtilsLabelEXT(primaryCommandBuffer->getHandle(), &label);
} }
break; break;
case CommandGraphNodeFunction::PopDebugMarker: case CommandGraphNodeFunction::PopDebugMarker:
ASSERT(!mOutsideRenderPassCommands.valid() && !mInsideRenderPassCommands.valid()); ASSERT(!mOutsideRenderPassCommands.valid() && !mInsideRenderPassCommands.valid());
if (vkCmdEndDebugUtilsLabelEXT) if (context->getRenderer()->enableDebugUtils())
{ {
vkCmdEndDebugUtilsLabelEXT(primaryCommandBuffer->getHandle()); primaryCommandBuffer->endDebugUtilsLabelEXT();
} }
break; break;
......
...@@ -2361,14 +2361,14 @@ angle::Result ContextVk::pushDebugGroup(const gl::Context *context, ...@@ -2361,14 +2361,14 @@ angle::Result ContextVk::pushDebugGroup(const gl::Context *context,
} }
else else
{ {
if (vkCmdInsertDebugUtilsLabelEXT) if (mRenderer->enableDebugUtils())
{ {
vk::PrimaryCommandBuffer *primary; vk::PrimaryCommandBuffer *primary;
ANGLE_TRY(getPrimaryCommandBuffer(&primary)); ANGLE_TRY(getPrimaryCommandBuffer(&primary));
VkDebugUtilsLabelEXT label; VkDebugUtilsLabelEXT label;
vk::MakeDebugUtilsLabel(source, message.c_str(), &label); vk::MakeDebugUtilsLabel(source, message.c_str(), &label);
vkCmdInsertDebugUtilsLabelEXT(primary->getHandle(), &label); primary->insertDebugUtilsLabelEXT(label);
} }
} }
...@@ -2383,11 +2383,11 @@ angle::Result ContextVk::popDebugGroup(const gl::Context *context) ...@@ -2383,11 +2383,11 @@ angle::Result ContextVk::popDebugGroup(const gl::Context *context)
} }
else else
{ {
if (vkCmdEndDebugUtilsLabelEXT) if (mRenderer->enableDebugUtils())
{ {
vk::PrimaryCommandBuffer *primary; vk::PrimaryCommandBuffer *primary;
ANGLE_TRY(getPrimaryCommandBuffer(&primary)); ANGLE_TRY(getPrimaryCommandBuffer(&primary));
vkCmdEndDebugUtilsLabelEXT(primary->getHandle()); primary->endDebugUtilsLabelEXT();
} }
} }
......
...@@ -560,6 +560,7 @@ RendererVk::RendererVk() ...@@ -560,6 +560,7 @@ RendererVk::RendererVk()
mCapsInitialized(false), mCapsInitialized(false),
mInstance(VK_NULL_HANDLE), mInstance(VK_NULL_HANDLE),
mEnableValidationLayers(false), mEnableValidationLayers(false),
mEnableDebugUtils(false),
mEnabledICD(vk::ICD::Default), mEnabledICD(vk::ICD::Default),
mDebugUtilsMessenger(VK_NULL_HANDLE), mDebugUtilsMessenger(VK_NULL_HANDLE),
mDebugReportCallback(VK_NULL_HANDLE), mDebugReportCallback(VK_NULL_HANDLE),
...@@ -724,15 +725,14 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk, ...@@ -724,15 +725,14 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
ExtensionNameList enabledInstanceExtensions; ExtensionNameList enabledInstanceExtensions;
enabledInstanceExtensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME); enabledInstanceExtensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
enabledInstanceExtensions.push_back(wsiExtension); enabledInstanceExtensions.push_back(wsiExtension);
bool enableDebugUtils = mEnableDebugUtils = mEnableValidationLayers &&
mEnableValidationLayers && ExtensionFound(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, instanceExtensionNames);
ExtensionFound(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, instanceExtensionNames);
bool enableDebugReport = bool enableDebugReport =
mEnableValidationLayers && !enableDebugUtils && mEnableValidationLayers && !mEnableDebugUtils &&
ExtensionFound(VK_EXT_DEBUG_REPORT_EXTENSION_NAME, instanceExtensionNames); ExtensionFound(VK_EXT_DEBUG_REPORT_EXTENSION_NAME, instanceExtensionNames);
if (enableDebugUtils) if (mEnableDebugUtils)
{ {
enabledInstanceExtensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); enabledInstanceExtensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
} }
...@@ -802,7 +802,7 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk, ...@@ -802,7 +802,7 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
ANGLE_VK_TRY(displayVk, vkCreateInstance(&instanceInfo, nullptr, &mInstance)); ANGLE_VK_TRY(displayVk, vkCreateInstance(&instanceInfo, nullptr, &mInstance));
volkLoadInstance(mInstance); volkLoadInstance(mInstance);
if (enableDebugUtils) if (mEnableDebugUtils)
{ {
// Use the newer EXT_debug_utils if it exists. // Use the newer EXT_debug_utils if it exists.
// Create the messenger callback. // Create the messenger callback.
......
...@@ -225,6 +225,8 @@ class RendererVk : angle::NonCopyable ...@@ -225,6 +225,8 @@ class RendererVk : angle::NonCopyable
return (mSharedGarbage.size() > mGarbageCollectionFlushThreshold); return (mSharedGarbage.size() > mGarbageCollectionFlushThreshold);
} }
bool enableDebugUtils() const { return mEnableDebugUtils; }
private: private:
angle::Result initializeDevice(DisplayVk *displayVk, uint32_t queueFamilyIndex); angle::Result initializeDevice(DisplayVk *displayVk, uint32_t queueFamilyIndex);
void ensureCapsInitialized() const; void ensureCapsInitialized() const;
...@@ -257,6 +259,7 @@ class RendererVk : angle::NonCopyable ...@@ -257,6 +259,7 @@ class RendererVk : angle::NonCopyable
VkInstance mInstance; VkInstance mInstance;
bool mEnableValidationLayers; bool mEnableValidationLayers;
bool mEnableDebugUtils;
vk::ICD mEnabledICD; vk::ICD mEnabledICD;
VkDebugUtilsMessengerEXT mDebugUtilsMessenger; VkDebugUtilsMessengerEXT mDebugUtilsMessenger;
VkDebugReportCallbackEXT mDebugReportCallback; VkDebugReportCallbackEXT mDebugReportCallback;
......
...@@ -371,6 +371,11 @@ class CommandBuffer : public WrappedObject<CommandBuffer, VkCommandBuffer> ...@@ -371,6 +371,11 @@ class CommandBuffer : public WrappedObject<CommandBuffer, VkCommandBuffer>
const VkBuffer *buffers, const VkBuffer *buffers,
const VkDeviceSize *offsets, const VkDeviceSize *offsets,
const VkDeviceSize *sizes); const VkDeviceSize *sizes);
// VK_EXT_debug_utils
void beginDebugUtilsLabelEXT(const VkDebugUtilsLabelEXT &labelInfo);
void endDebugUtilsLabelEXT();
void insertDebugUtilsLabelEXT(const VkDebugUtilsLabelEXT &labelInfo);
}; };
} // namespace priv } // namespace priv
...@@ -1086,6 +1091,7 @@ ANGLE_INLINE void CommandBuffer::beginTransformFeedbackEXT(uint32_t firstCounter ...@@ -1086,6 +1091,7 @@ ANGLE_INLINE void CommandBuffer::beginTransformFeedbackEXT(uint32_t firstCounter
const VkDeviceSize *counterBufferOffsets) const VkDeviceSize *counterBufferOffsets)
{ {
ASSERT(valid()); ASSERT(valid());
ASSERT(vkCmdBeginTransformFeedbackEXT);
vkCmdBeginTransformFeedbackEXT(mHandle, firstCounterBuffer, counterBufferCount, counterBuffers, vkCmdBeginTransformFeedbackEXT(mHandle, firstCounterBuffer, counterBufferCount, counterBuffers,
counterBufferOffsets); counterBufferOffsets);
} }
...@@ -1096,6 +1102,7 @@ ANGLE_INLINE void CommandBuffer::endTransformFeedbackEXT(uint32_t firstCounterBu ...@@ -1096,6 +1102,7 @@ ANGLE_INLINE void CommandBuffer::endTransformFeedbackEXT(uint32_t firstCounterBu
const VkDeviceSize *counterBufferOffsets) const VkDeviceSize *counterBufferOffsets)
{ {
ASSERT(valid()); ASSERT(valid());
ASSERT(vkCmdEndTransformFeedbackEXT);
vkCmdEndTransformFeedbackEXT(mHandle, firstCounterBuffer, counterBufferCount, counterBuffers, vkCmdEndTransformFeedbackEXT(mHandle, firstCounterBuffer, counterBufferCount, counterBuffers,
counterBufferOffsets); counterBufferOffsets);
} }
...@@ -1107,9 +1114,31 @@ ANGLE_INLINE void CommandBuffer::bindTransformFeedbackBuffersEXT(uint32_t firstB ...@@ -1107,9 +1114,31 @@ ANGLE_INLINE void CommandBuffer::bindTransformFeedbackBuffersEXT(uint32_t firstB
const VkDeviceSize *sizes) const VkDeviceSize *sizes)
{ {
ASSERT(valid()); ASSERT(valid());
ASSERT(vkCmdBindTransformFeedbackBuffersEXT);
vkCmdBindTransformFeedbackBuffersEXT(mHandle, firstBinding, bindingCount, buffers, offsets, vkCmdBindTransformFeedbackBuffersEXT(mHandle, firstBinding, bindingCount, buffers, offsets,
sizes); sizes);
} }
ANGLE_INLINE void CommandBuffer::beginDebugUtilsLabelEXT(const VkDebugUtilsLabelEXT &labelInfo)
{
ASSERT(valid());
ASSERT(vkCmdBeginDebugUtilsLabelEXT);
vkCmdBeginDebugUtilsLabelEXT(mHandle, &labelInfo);
}
ANGLE_INLINE void CommandBuffer::endDebugUtilsLabelEXT()
{
ASSERT(valid());
ASSERT(vkCmdEndDebugUtilsLabelEXT);
vkCmdEndDebugUtilsLabelEXT(mHandle);
}
ANGLE_INLINE void CommandBuffer::insertDebugUtilsLabelEXT(const VkDebugUtilsLabelEXT &labelInfo)
{
ASSERT(valid());
ASSERT(vkCmdInsertDebugUtilsLabelEXT);
vkCmdInsertDebugUtilsLabelEXT(mHandle, &labelInfo);
}
} // namespace priv } // namespace priv
// Image implementation. // Image implementation.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment