Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Control GL error checking and tracing via GN options. #33734

Merged
merged 1 commit into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions impeller/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ config("impeller_public_config") {
defines += [ "IMPELLER_ENABLE_OPENGLES=1" ]
}

if (impeller_trace_all_gl_calls) {
defines += [ "IMPELLER_TRACE_ALL_GL_CALLS" ]
}

if (impeller_error_check_all_gl_calls) {
defines += [ "IMPELLER_ERROR_CHECK_ALL_GL_CALLS" ]
}

if (is_win) {
defines += [
"_USE_MATH_DEFINES",
Expand Down
6 changes: 6 additions & 0 deletions impeller/renderer/backend/gles/proc_table_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "flutter/fml/logging.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/mapping.h"
#include "flutter/fml/trace_event.h"
#include "impeller/renderer/backend/gles/capabilities_gles.h"
#include "impeller/renderer/backend/gles/description_gles.h"
#include "impeller/renderer/backend/gles/gles.h"
Expand Down Expand Up @@ -64,7 +65,12 @@ struct GLProc {
///
template <class... Args>
auto operator()(Args&&... args) const {
#ifdef IMPELLER_ERROR_CHECK_ALL_GL_CALLS
AutoErrorCheck error(error_fn, name);
#endif // IMPELLER_ERROR_CHECK_ALL_GL_CALLS
#ifdef IMPELLER_TRACE_ALL_GL_CALLS
TRACE_EVENT0("impeller", name);
#endif // IMPELLER_TRACE_ALL_GL_CALLS
return function(std::forward<Args>(args)...);
}

Expand Down
7 changes: 7 additions & 0 deletions impeller/tools/impeller.gni
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ declare_args() {
# If this is the empty string, impellerc will be built.
# If it is non-empty, it should be the absolute path to impellerc.
impeller_use_prebuilt_impellerc = ""

# If enabled, all OpenGL calls will be traced. Because additional trace
# overhead may be substantial, this is not enabled by default.
impeller_trace_all_gl_calls = false

# Call glGetError after each OpenGL call and log failures.
impeller_error_check_all_gl_calls = is_debug
}

declare_args() {
Expand Down