[Impeller] disable GLES tracing unless opted in. (#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.
This commit is contained in:
Jonah Williams 2025-03-25 17:08:40 -07:00 committed by GitHub
parent 7b1d69606f
commit 5efbd2e648
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 8 deletions

View File

@ -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();

View File

@ -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);

View File

@ -98,13 +98,7 @@ TEST(ReactorGLES, UntrackedHandle) {
TEST(ReactorGLES, NameUntrackedHandle) {
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));
@ -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);