Skip to content

Commit cb02c67

Browse files
Jonah Williamsyuuangzhang
authored andcommitted
[Impeller] disable GLES tracing unless opted in. (flutter#165887)
GLES tracing may add substantial overhead on some devices. Since this is only useful when using frame capture tools, and its unlikely anyone that isn't an engine developer (or who knows how to compile the engine) will use them - we can turn off with a define. If there are other usecases we need to cover later this can be made to use the new flag system.
1 parent 55d20ce commit cb02c67

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

engine/src/flutter/impeller/renderer/backend/gles/proc_table_gles.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ ProcTableGLES::ProcTableGLES( // NOLINT(google-readability-function-size)
129129

130130
#undef IMPELLER_PROC
131131

132-
if (!description_->HasDebugExtension()) {
132+
if (!IP_ENABLE_GLES_LABELING || !description_->HasDebugExtension()) {
133133
PushDebugGroupKHR.Reset();
134134
PopDebugGroupKHR.Reset();
135135
ObjectLabelKHR.Reset();

engine/src/flutter/impeller/renderer/backend/gles/proc_table_gles.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#include "impeller/renderer/backend/gles/description_gles.h"
1515
#include "impeller/renderer/backend/gles/gles.h"
1616

17+
/// Enable to allow GLES to push/pop labels for usage in GPU traces
18+
#define IP_ENABLE_GLES_LABELING false
19+
1720
namespace impeller {
1821

1922
const char* GLErrorToString(GLenum value);

engine/src/flutter/impeller/renderer/backend/gles/test/reactor_unittests.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,7 @@ TEST(ReactorGLES, UntrackedHandle) {
9898

9999
TEST(ReactorGLES, NameUntrackedHandle) {
100100
auto mock_gles_impl = std::make_unique<NiceMock<MockGLESImpl>>();
101-
102-
EXPECT_CALL(*mock_gles_impl, GenTextures(1, _))
103-
.WillOnce([](GLsizei size, GLuint* queries) { queries[0] = 1234; });
104-
EXPECT_CALL(*mock_gles_impl,
105-
ObjectLabelKHR(_, 1234, _, ::testing::StrEq("hello, joe!")))
106-
.Times(1);
107-
ON_CALL(*mock_gles_impl, IsTexture).WillByDefault(::testing::Return(GL_TRUE));
101+
NiceMock<MockGLESImpl>* raw_mock_gles = mock_gles_impl.get();
108102

109103
std::shared_ptr<MockGLES> mock_gles =
110104
MockGLES::Init(std::move(mock_gles_impl));
@@ -115,6 +109,13 @@ TEST(ReactorGLES, NameUntrackedHandle) {
115109
GTEST_SKIP() << "This device doesn't support labelling.";
116110
}
117111

112+
EXPECT_CALL(*raw_mock_gles, GenTextures(1, _))
113+
.WillOnce([](GLsizei size, GLuint* queries) { queries[0] = 1234; });
114+
EXPECT_CALL(*raw_mock_gles,
115+
ObjectLabelKHR(_, 1234, _, ::testing::StrEq("hello, joe!")))
116+
.Times(1);
117+
ON_CALL(*raw_mock_gles, IsTexture).WillByDefault(::testing::Return(GL_TRUE));
118+
118119
auto worker = std::make_shared<TestWorker>();
119120
auto reactor = std::make_shared<ReactorGLES>(std::move(proc_table));
120121
reactor->AddWorker(worker);

0 commit comments

Comments
 (0)