зеркало из https://github.com/AvaloniaUI/angle.git
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/+/2055554 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
bb7534ee99
Коммит
12a36dd9ea
|
@ -722,33 +722,31 @@ angle::Result CommandGraphNode::visitAndExecute(vk::Context *context,
|
|||
case CommandGraphNodeFunction::InsertDebugMarker:
|
||||
ASSERT(!mOutsideRenderPassCommands.valid() && !mInsideRenderPassCommands.valid());
|
||||
|
||||
if (vkCmdInsertDebugUtilsLabelEXT)
|
||||
if (context->getRenderer()->enableDebugUtils())
|
||||
{
|
||||
VkDebugUtilsLabelEXT label;
|
||||
MakeDebugUtilsLabel(mDebugMarkerSource, mDebugMarker.c_str(), &label);
|
||||
|
||||
vkCmdInsertDebugUtilsLabelEXT(primaryCommandBuffer->getHandle(), &label);
|
||||
primaryCommandBuffer->insertDebugUtilsLabelEXT(label);
|
||||
}
|
||||
break;
|
||||
|
||||
case CommandGraphNodeFunction::PushDebugMarker:
|
||||
ASSERT(!mOutsideRenderPassCommands.valid() && !mInsideRenderPassCommands.valid());
|
||||
|
||||
if (vkCmdBeginDebugUtilsLabelEXT)
|
||||
if (context->getRenderer()->enableDebugUtils())
|
||||
{
|
||||
VkDebugUtilsLabelEXT label;
|
||||
MakeDebugUtilsLabel(mDebugMarkerSource, mDebugMarker.c_str(), &label);
|
||||
|
||||
vkCmdBeginDebugUtilsLabelEXT(primaryCommandBuffer->getHandle(), &label);
|
||||
primaryCommandBuffer->beginDebugUtilsLabelEXT(label);
|
||||
}
|
||||
break;
|
||||
|
||||
case CommandGraphNodeFunction::PopDebugMarker:
|
||||
ASSERT(!mOutsideRenderPassCommands.valid() && !mInsideRenderPassCommands.valid());
|
||||
|
||||
if (vkCmdEndDebugUtilsLabelEXT)
|
||||
if (context->getRenderer()->enableDebugUtils())
|
||||
{
|
||||
vkCmdEndDebugUtilsLabelEXT(primaryCommandBuffer->getHandle());
|
||||
primaryCommandBuffer->endDebugUtilsLabelEXT();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -2361,14 +2361,14 @@ angle::Result ContextVk::pushDebugGroup(const gl::Context *context,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (vkCmdInsertDebugUtilsLabelEXT)
|
||||
if (mRenderer->enableDebugUtils())
|
||||
{
|
||||
vk::PrimaryCommandBuffer *primary;
|
||||
ANGLE_TRY(getPrimaryCommandBuffer(&primary));
|
||||
|
||||
VkDebugUtilsLabelEXT 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)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (vkCmdEndDebugUtilsLabelEXT)
|
||||
if (mRenderer->enableDebugUtils())
|
||||
{
|
||||
vk::PrimaryCommandBuffer *primary;
|
||||
ANGLE_TRY(getPrimaryCommandBuffer(&primary));
|
||||
vkCmdEndDebugUtilsLabelEXT(primary->getHandle());
|
||||
primary->endDebugUtilsLabelEXT();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -560,6 +560,7 @@ RendererVk::RendererVk()
|
|||
mCapsInitialized(false),
|
||||
mInstance(VK_NULL_HANDLE),
|
||||
mEnableValidationLayers(false),
|
||||
mEnableDebugUtils(false),
|
||||
mEnabledICD(vk::ICD::Default),
|
||||
mDebugUtilsMessenger(VK_NULL_HANDLE),
|
||||
mDebugReportCallback(VK_NULL_HANDLE),
|
||||
|
@ -724,15 +725,14 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
|
|||
ExtensionNameList enabledInstanceExtensions;
|
||||
enabledInstanceExtensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
|
||||
enabledInstanceExtensions.push_back(wsiExtension);
|
||||
bool enableDebugUtils =
|
||||
mEnableValidationLayers &&
|
||||
ExtensionFound(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, instanceExtensionNames);
|
||||
mEnableDebugUtils = mEnableValidationLayers &&
|
||||
ExtensionFound(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, instanceExtensionNames);
|
||||
|
||||
bool enableDebugReport =
|
||||
mEnableValidationLayers && !enableDebugUtils &&
|
||||
mEnableValidationLayers && !mEnableDebugUtils &&
|
||||
ExtensionFound(VK_EXT_DEBUG_REPORT_EXTENSION_NAME, instanceExtensionNames);
|
||||
|
||||
if (enableDebugUtils)
|
||||
if (mEnableDebugUtils)
|
||||
{
|
||||
enabledInstanceExtensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
|
||||
}
|
||||
|
@ -802,7 +802,7 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
|
|||
ANGLE_VK_TRY(displayVk, vkCreateInstance(&instanceInfo, nullptr, &mInstance));
|
||||
volkLoadInstance(mInstance);
|
||||
|
||||
if (enableDebugUtils)
|
||||
if (mEnableDebugUtils)
|
||||
{
|
||||
// Use the newer EXT_debug_utils if it exists.
|
||||
// Create the messenger callback.
|
||||
|
|
|
@ -225,6 +225,8 @@ class RendererVk : angle::NonCopyable
|
|||
return (mSharedGarbage.size() > mGarbageCollectionFlushThreshold);
|
||||
}
|
||||
|
||||
bool enableDebugUtils() const { return mEnableDebugUtils; }
|
||||
|
||||
private:
|
||||
angle::Result initializeDevice(DisplayVk *displayVk, uint32_t queueFamilyIndex);
|
||||
void ensureCapsInitialized() const;
|
||||
|
@ -257,6 +259,7 @@ class RendererVk : angle::NonCopyable
|
|||
|
||||
VkInstance mInstance;
|
||||
bool mEnableValidationLayers;
|
||||
bool mEnableDebugUtils;
|
||||
vk::ICD mEnabledICD;
|
||||
VkDebugUtilsMessengerEXT mDebugUtilsMessenger;
|
||||
VkDebugReportCallbackEXT mDebugReportCallback;
|
||||
|
|
|
@ -371,6 +371,11 @@ class CommandBuffer : public WrappedObject<CommandBuffer, VkCommandBuffer>
|
|||
const VkBuffer *buffers,
|
||||
const VkDeviceSize *offsets,
|
||||
const VkDeviceSize *sizes);
|
||||
|
||||
// VK_EXT_debug_utils
|
||||
void beginDebugUtilsLabelEXT(const VkDebugUtilsLabelEXT &labelInfo);
|
||||
void endDebugUtilsLabelEXT();
|
||||
void insertDebugUtilsLabelEXT(const VkDebugUtilsLabelEXT &labelInfo);
|
||||
};
|
||||
} // namespace priv
|
||||
|
||||
|
@ -1086,6 +1091,7 @@ ANGLE_INLINE void CommandBuffer::beginTransformFeedbackEXT(uint32_t firstCounter
|
|||
const VkDeviceSize *counterBufferOffsets)
|
||||
{
|
||||
ASSERT(valid());
|
||||
ASSERT(vkCmdBeginTransformFeedbackEXT);
|
||||
vkCmdBeginTransformFeedbackEXT(mHandle, firstCounterBuffer, counterBufferCount, counterBuffers,
|
||||
counterBufferOffsets);
|
||||
}
|
||||
|
@ -1096,6 +1102,7 @@ ANGLE_INLINE void CommandBuffer::endTransformFeedbackEXT(uint32_t firstCounterBu
|
|||
const VkDeviceSize *counterBufferOffsets)
|
||||
{
|
||||
ASSERT(valid());
|
||||
ASSERT(vkCmdEndTransformFeedbackEXT);
|
||||
vkCmdEndTransformFeedbackEXT(mHandle, firstCounterBuffer, counterBufferCount, counterBuffers,
|
||||
counterBufferOffsets);
|
||||
}
|
||||
|
@ -1107,9 +1114,31 @@ ANGLE_INLINE void CommandBuffer::bindTransformFeedbackBuffersEXT(uint32_t firstB
|
|||
const VkDeviceSize *sizes)
|
||||
{
|
||||
ASSERT(valid());
|
||||
ASSERT(vkCmdBindTransformFeedbackBuffersEXT);
|
||||
vkCmdBindTransformFeedbackBuffersEXT(mHandle, firstBinding, bindingCount, buffers, offsets,
|
||||
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
|
||||
|
||||
// Image implementation.
|
||||
|
|
Загрузка…
Ссылка в новой задаче