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

Commit 0d1057e

Browse files
authored
[Impeller] Control GL error checking and tracing via GN options. (#33734)
1 parent 961ad46 commit 0d1057e

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

impeller/BUILD.gn

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ config("impeller_public_config") {
2525
defines += [ "IMPELLER_ENABLE_OPENGLES=1" ]
2626
}
2727

28+
if (impeller_trace_all_gl_calls) {
29+
defines += [ "IMPELLER_TRACE_ALL_GL_CALLS" ]
30+
}
31+
32+
if (impeller_error_check_all_gl_calls) {
33+
defines += [ "IMPELLER_ERROR_CHECK_ALL_GL_CALLS" ]
34+
}
35+
2836
if (is_win) {
2937
defines += [
3038
"_USE_MATH_DEFINES",

impeller/renderer/backend/gles/proc_table_gles.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "flutter/fml/logging.h"
1212
#include "flutter/fml/macros.h"
1313
#include "flutter/fml/mapping.h"
14+
#include "flutter/fml/trace_event.h"
1415
#include "impeller/renderer/backend/gles/capabilities_gles.h"
1516
#include "impeller/renderer/backend/gles/description_gles.h"
1617
#include "impeller/renderer/backend/gles/gles.h"
@@ -64,7 +65,12 @@ struct GLProc {
6465
///
6566
template <class... Args>
6667
auto operator()(Args&&... args) const {
68+
#ifdef IMPELLER_ERROR_CHECK_ALL_GL_CALLS
6769
AutoErrorCheck error(error_fn, name);
70+
#endif // IMPELLER_ERROR_CHECK_ALL_GL_CALLS
71+
#ifdef IMPELLER_TRACE_ALL_GL_CALLS
72+
TRACE_EVENT0("impeller", name);
73+
#endif // IMPELLER_TRACE_ALL_GL_CALLS
6874
return function(std::forward<Args>(args)...);
6975
}
7076

impeller/tools/impeller.gni

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ declare_args() {
2323
# If this is the empty string, impellerc will be built.
2424
# If it is non-empty, it should be the absolute path to impellerc.
2525
impeller_use_prebuilt_impellerc = ""
26+
27+
# If enabled, all OpenGL calls will be traced. Because additional trace
28+
# overhead may be substantial, this is not enabled by default.
29+
impeller_trace_all_gl_calls = false
30+
31+
# Call glGetError after each OpenGL call and log failures.
32+
impeller_error_check_all_gl_calls = is_debug
2633
}
2734

2835
declare_args() {

0 commit comments

Comments
 (0)