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

Commit ea275c3

Browse files
[Impeller] log specific framebuffer incomplete error. (#46692)
This is much easier to debug if we know the actual error code.
1 parent 4a4d9de commit ea275c3

File tree

5 files changed

+51
-3
lines changed

5 files changed

+51
-3
lines changed

impeller/renderer/backend/gles/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ impeller_component("gles_unittests") {
1515
testonly = true
1616
sources = [
1717
"test/capabilities_unittests.cc",
18+
"test/formats_gles_unittests.cc",
1819
"test/mock_gles.cc",
1920
"test/mock_gles.h",
2021
"test/mock_gles_unittests.cc",

impeller/renderer/backend/gles/formats_gles.cc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@
66

77
namespace impeller {
88

9-
//
9+
std::string DebugToFramebufferError(int status) {
10+
switch (status) {
11+
case GL_FRAMEBUFFER_UNDEFINED:
12+
return "GL_FRAMEBUFFER_UNDEFINED";
13+
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
14+
return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
15+
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
16+
return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
17+
case GL_FRAMEBUFFER_UNSUPPORTED:
18+
return "GL_FRAMEBUFFER_UNSUPPORTED";
19+
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
20+
return "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE";
21+
default:
22+
return "Unknown error code: " + std::to_string(status);
23+
}
24+
}
1025

1126
} // namespace impeller

impeller/renderer/backend/gles/formats_gles.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,6 @@ constexpr std::optional<GLenum> ToTextureTarget(TextureType type) {
194194
FML_UNREACHABLE();
195195
}
196196

197+
std::string DebugToFramebufferError(int status);
198+
197199
} // namespace impeller

impeller/renderer/backend/gles/render_pass_gles.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,10 @@ struct RenderPassData {
193193
}
194194
}
195195

196-
if (gl.CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
197-
VALIDATION_LOG << "Could not create a complete frambuffer.";
196+
auto status = gl.CheckFramebufferStatus(GL_FRAMEBUFFER);
197+
if (status != GL_FRAMEBUFFER_COMPLETE) {
198+
VALIDATION_LOG << "Could not create a complete frambuffer: "
199+
<< DebugToFramebufferError(status);
198200
return false;
199201
}
200202
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include "flutter/testing/testing.h" // IWYU pragma: keep
6+
#include "gtest/gtest.h"
7+
#include "impeller/renderer/backend/gles/formats_gles.h"
8+
9+
namespace impeller {
10+
namespace testing {
11+
12+
TEST(FormatsGLES, CanFormatFramebufferErrorMessage) {
13+
ASSERT_EQ(DebugToFramebufferError(GL_FRAMEBUFFER_UNDEFINED),
14+
"GL_FRAMEBUFFER_UNDEFINED");
15+
ASSERT_EQ(DebugToFramebufferError(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT),
16+
"GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
17+
ASSERT_EQ(
18+
DebugToFramebufferError(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT),
19+
"GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");
20+
ASSERT_EQ(DebugToFramebufferError(GL_FRAMEBUFFER_UNSUPPORTED),
21+
"GL_FRAMEBUFFER_UNSUPPORTED");
22+
ASSERT_EQ(DebugToFramebufferError(GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE),
23+
"GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE");
24+
ASSERT_EQ(DebugToFramebufferError(0), "Unknown error code: 0");
25+
}
26+
27+
} // namespace testing
28+
} // namespace impeller

0 commit comments

Comments
 (0)