1 //
2 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // DebugAnnotatorVk.cpp: Vulkan helpers for adding trace annotations.
7 //
8
9 #include "libANGLE/renderer/vulkan/DebugAnnotatorVk.h"
10
11 #include "common/entry_points_enum_autogen.h"
12 #include "libANGLE/Context.h"
13 #include "libANGLE/renderer/vulkan/ContextVk.h"
14
15 namespace rx
16 {
17
DebugAnnotatorVk()18 DebugAnnotatorVk::DebugAnnotatorVk() {}
19
~DebugAnnotatorVk()20 DebugAnnotatorVk::~DebugAnnotatorVk() {}
21
beginEvent(gl::Context * context,angle::EntryPoint entryPoint,const char * eventName,const char * eventMessage)22 void DebugAnnotatorVk::beginEvent(gl::Context *context,
23 angle::EntryPoint entryPoint,
24 const char *eventName,
25 const char *eventMessage)
26 {
27 angle::LoggingAnnotator::beginEvent(context, entryPoint, eventName, eventMessage);
28 if (vkCmdBeginDebugUtilsLabelEXT && context)
29 {
30 ContextVk *contextVk = vk::GetImpl(static_cast<gl::Context *>(context));
31 contextVk->logEvent(eventMessage);
32 }
33 }
34
endEvent(gl::Context * context,const char * eventName,angle::EntryPoint entryPoint)35 void DebugAnnotatorVk::endEvent(gl::Context *context,
36 const char *eventName,
37 angle::EntryPoint entryPoint)
38 {
39 angle::LoggingAnnotator::endEvent(context, eventName, entryPoint);
40 if (vkCmdBeginDebugUtilsLabelEXT && context)
41 {
42 ContextVk *contextVk = vk::GetImpl(static_cast<gl::Context *>(context));
43 if (angle::IsDrawEntryPoint(entryPoint))
44 {
45 contextVk->endEventLog(entryPoint, PipelineType::Graphics);
46 }
47 else if (angle::IsDispatchEntryPoint(entryPoint))
48 {
49 contextVk->endEventLog(entryPoint, PipelineType::Compute);
50 }
51 else if (angle::IsClearEntryPoint(entryPoint) || angle::IsQueryEntryPoint(entryPoint))
52 {
53 contextVk->endEventLogForClearOrQuery();
54 }
55 }
56 }
57
getStatus(const gl::Context * context)58 bool DebugAnnotatorVk::getStatus(const gl::Context *context)
59 {
60 return true;
61 }
62 } // namespace rx
63