Skip to content

[Impeller] disable GLES tracing unless opted in. #165887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 26, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ ProcTableGLES::ProcTableGLES( // NOLINT(google-readability-function-size)

#undef IMPELLER_PROC

if (!description_->HasDebugExtension()) {
if (!IP_ENABLE_GLES_LABELING || !description_->HasDebugExtension()) {
PushDebugGroupKHR.Reset();
PopDebugGroupKHR.Reset();
ObjectLabelKHR.Reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#include "impeller/renderer/backend/gles/description_gles.h"
#include "impeller/renderer/backend/gles/gles.h"

/// Enable to allow GLES to push/pop labels for usage in GPU traces
#define IP_ENABLE_GLES_LABELING false

namespace impeller {

const char* GLErrorToString(GLenum value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,7 @@ TEST(ReactorGLES, UntrackedHandle) {

TEST(ReactorGLES, NameUntrackedHandle) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of deleting this, why not just put it in the preprocessor guard. This test seems to point to a better way to disable this: SupportsDebugLabels(). If we turn that off this test will be skipped automatically.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah i shouldn't remove this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gtest skip still triggers the gmock assertions though, is there a way to disable them?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just move the expect calls to after the skip?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its after we've moved the mock gles :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure the GTEST_SKIP doesn't just handle cancelling the expects?

You could keep a raw pointer around to do the expect_calls after the skips. It's not pretty but it's a test and we know it will still be in memory.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try the raw_ptr

auto mock_gles_impl = std::make_unique<NiceMock<MockGLESImpl>>();

EXPECT_CALL(*mock_gles_impl, GenTextures(1, _))
.WillOnce([](GLsizei size, GLuint* queries) { queries[0] = 1234; });
EXPECT_CALL(*mock_gles_impl,
ObjectLabelKHR(_, 1234, _, ::testing::StrEq("hello, joe!")))
.Times(1);
ON_CALL(*mock_gles_impl, IsTexture).WillByDefault(::testing::Return(GL_TRUE));
NiceMock<MockGLESImpl>* raw_mock_gles = mock_gles_impl.get();

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

EXPECT_CALL(*raw_mock_gles, GenTextures(1, _))
.WillOnce([](GLsizei size, GLuint* queries) { queries[0] = 1234; });
EXPECT_CALL(*raw_mock_gles,
ObjectLabelKHR(_, 1234, _, ::testing::StrEq("hello, joe!")))
.Times(1);
ON_CALL(*raw_mock_gles, IsTexture).WillByDefault(::testing::Return(GL_TRUE));

auto worker = std::make_shared<TestWorker>();
auto reactor = std::make_shared<ReactorGLES>(std::move(proc_table));
reactor->AddWorker(worker);
Expand Down