Commit 06a9d529 by Jamie Madill Committed by Commit Bot

Add build flag to control runtime annotator checks.

This restores the prior path where angle_enable_trace would let ANGLE write a debug.txt file without needing environment variables or run-time annotator attachments. Bug: b/170249632 Change-Id: I28693f038572638eb6531c5bb8e42d6cc7a65451 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2523912Reviewed-by: 's avatarIan Elliott <ianelliott@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
parent 9825695e
......@@ -40,6 +40,9 @@ declare_args() {
# Abseil has trouble supporting MSVC, particularly regarding component builds.
# http://crbug.com/1126524
angle_enable_abseil = angle_has_build && is_clang
# Adds run-time checks to filter out EVENT() messages when the debug annotator is disabled.
angle_enable_annotator_run_time_checks = false
}
if (angle_build_all) {
......@@ -250,6 +253,9 @@ config("debug_annotations_config") {
if (is_debug) {
defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
}
if (angle_enable_annotator_run_time_checks) {
defines = [ "ANGLE_ENABLE_ANNOTATOR_RUN_TIME_CHECKS" ]
}
}
config("angle_release_asserts_config") {
......
......@@ -89,6 +89,15 @@ bool DebugAnnotationsActive()
#endif
}
bool ShouldBeginScopedEvent()
{
#if defined(ANGLE_ENABLE_ANNOTATOR_RUN_TIME_CHECKS)
return DebugAnnotationsActive();
#else
return true;
#endif // defined(ANGLE_ENABLE_ANNOTATOR_RUN_TIME_CHECKS)
}
bool DebugAnnotationsInitialized()
{
return g_debugAnnotator != nullptr;
......@@ -145,8 +154,10 @@ void ScopedPerfEventHelper::begin(const char *format, ...)
va_end(vararg);
ANGLE_LOG(EVENT) << std::string(&buffer[0], len);
// Do not need to call DebugAnnotationsActive() here, because it was called in EVENT()
g_debugAnnotator->beginEvent(mContext, mEntryPoint, mFunctionName, buffer.data());
if (DebugAnnotationsInitialized())
{
g_debugAnnotator->beginEvent(mContext, mEntryPoint, mFunctionName, buffer.data());
}
}
LogMessage::LogMessage(const char *file, const char *function, int line, LogSeverity severity)
......
......@@ -107,6 +107,7 @@ class DebugAnnotator : angle::NonCopyable
virtual void logMessage(const LogMessage &msg) const = 0;
};
bool ShouldBeginScopedEvent();
void InitializeDebugAnnotations(DebugAnnotator *debugAnnotator);
void UninitializeDebugAnnotations();
bool DebugAnnotationsActive();
......@@ -259,7 +260,7 @@ std::ostream &FmtHex(std::ostream &os, T value)
gl::ScopedPerfEventHelper scopedPerfEventHelper##__LINE__(context, entryPoint); \
do \
{ \
if (gl::DebugAnnotationsActive()) \
if (gl::ShouldBeginScopedEvent()) \
{ \
scopedPerfEventHelper##__LINE__.begin("%s(" message ")", function, \
__VA_ARGS__); \
......@@ -270,7 +271,7 @@ std::ostream &FmtHex(std::ostream &os, T value)
gl::ScopedPerfEventHelper scopedPerfEventHelper(context, entryPoint); \
do \
{ \
if (gl::DebugAnnotationsActive()) \
if (gl::ShouldBeginScopedEvent()) \
{ \
scopedPerfEventHelper.begin("%s(" message ")", function, ##__VA_ARGS__); \
} \
......
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