Reenabled labelling test with a capabilities check. (flutter/engine#57160)

fixes https://github.com/flutter/flutter/issues/160180

I'm unable to reproduce the problem locally but this is the most likely cause.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
gaaclarke 2024-12-12 13:11:36 -08:00 committed by GitHub
parent 84931c12d7
commit ad317842d3
3 changed files with 19 additions and 5 deletions

View File

@ -357,13 +357,20 @@ static bool ResourceIsLive(const ProcTableGLES& gl,
FML_UNREACHABLE();
}
bool ProcTableGLES::SupportsDebugLabels() const {
if (debug_label_max_length_ <= 0) {
return false;
}
if (!ObjectLabelKHR.IsAvailable()) {
return false;
}
return true;
}
bool ProcTableGLES::SetDebugLabel(DebugResourceType type,
GLint name,
std::string_view label) const {
if (debug_label_max_length_ <= 0) {
return true;
}
if (!ObjectLabelKHR.IsAvailable()) {
if (!SupportsDebugLabels()) {
return true;
}
if (!ResourceIsLive(*this, type, name)) {

View File

@ -314,6 +314,8 @@ class ProcTableGLES {
bool IsCurrentFramebufferComplete() const;
bool SupportsDebugLabels() const;
bool SetDebugLabel(DebugResourceType type,
GLint name,
std::string_view label) const;

View File

@ -95,7 +95,7 @@ TEST(ReactorGLES, UntrackedHandle) {
EXPECT_TRUE(reactor->React());
}
TEST(ReactorGLES, DISABLED_NameUntrackedHandle) {
TEST(ReactorGLES, NameUntrackedHandle) {
auto mock_gles_impl = std::make_unique<MockGLESImpl>();
EXPECT_CALL(*mock_gles_impl, GenTextures(1, _))
@ -108,6 +108,11 @@ TEST(ReactorGLES, DISABLED_NameUntrackedHandle) {
MockGLES::Init(std::move(mock_gles_impl));
ProcTableGLES::Resolver resolver = kMockResolverGLES;
auto proc_table = std::make_unique<ProcTableGLES>(resolver);
if (!proc_table->SupportsDebugLabels()) {
GTEST_SKIP() << "This device doesn't support labelling.";
}
auto worker = std::make_shared<TestWorker>();
auto reactor = std::make_shared<ReactorGLES>(std::move(proc_table));
reactor->AddWorker(worker);