Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
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
1 change: 1 addition & 0 deletions impeller/renderer/backend/gles/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ impeller_component("gles_unittests") {
testonly = true
sources = [
"test/capabilities_unittests.cc",
"test/formats_gles_unittests.cc",
"test/mock_gles.cc",
"test/mock_gles.h",
"test/mock_gles_unittests.cc",
Expand Down
17 changes: 16 additions & 1 deletion impeller/renderer/backend/gles/formats_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@

namespace impeller {

//
std::string DebugToFramebufferError(int status) {
switch (status) {
case GL_FRAMEBUFFER_UNDEFINED:
return "GL_FRAMEBUFFER_UNDEFINED";
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
case GL_FRAMEBUFFER_UNSUPPORTED:
return "GL_FRAMEBUFFER_UNSUPPORTED";
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
return "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE";
default:
return "Unknown error code: " + std::to_string(status);
}
}

} // namespace impeller
2 changes: 2 additions & 0 deletions impeller/renderer/backend/gles/formats_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,6 @@ constexpr std::optional<GLenum> ToTextureTarget(TextureType type) {
FML_UNREACHABLE();
}

std::string DebugToFramebufferError(int status);

} // namespace impeller
6 changes: 4 additions & 2 deletions impeller/renderer/backend/gles/render_pass_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ struct RenderPassData {
}
}

if (gl.CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
VALIDATION_LOG << "Could not create a complete frambuffer.";
auto status = gl.CheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
VALIDATION_LOG << "Could not create a complete frambuffer: "
<< DebugToFramebufferError(status);
return false;
}
}
Expand Down
28 changes: 28 additions & 0 deletions impeller/renderer/backend/gles/test/formats_gles_unittests.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/testing/testing.h" // IWYU pragma: keep
#include "gtest/gtest.h"
#include "impeller/renderer/backend/gles/formats_gles.h"

namespace impeller {
namespace testing {

TEST(FormatsGLES, CanFormatFramebufferErrorMessage) {
ASSERT_EQ(DebugToFramebufferError(GL_FRAMEBUFFER_UNDEFINED),
"GL_FRAMEBUFFER_UNDEFINED");
ASSERT_EQ(DebugToFramebufferError(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT),
"GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
ASSERT_EQ(
DebugToFramebufferError(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT),
"GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");
ASSERT_EQ(DebugToFramebufferError(GL_FRAMEBUFFER_UNSUPPORTED),
"GL_FRAMEBUFFER_UNSUPPORTED");
ASSERT_EQ(DebugToFramebufferError(GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE),
"GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE");
ASSERT_EQ(DebugToFramebufferError(0), "Unknown error code: 0");
}

} // namespace testing
} // namespace impeller