mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
For consistency with the Test.*Context classes for other backends, which live in their own implementation file with their own header, extract TestEGLContext to its own header and TU so that in cases where only a TestEGLContext is required (e.g. EmbedderTestBackingStoreProducerGL), we don't need to include all the various test GL surface classes as well. GetEGLError is used by both TestEGLContext and the TestGLSurface classes, so moves to its own utils file. No tests because this is a refactoring with no semantic changes, and the code itself is test code. Issue: https://github.com/flutter/flutter/issues/158998 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
75 lines
1.7 KiB
C++
75 lines
1.7 KiB
C++
// 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/test_gl_utils.h"
|
|
|
|
#include <EGL/egl.h>
|
|
|
|
#include <sstream>
|
|
|
|
namespace flutter::testing {
|
|
|
|
std::string GetEGLError() {
|
|
std::stringstream stream;
|
|
|
|
auto error = ::eglGetError();
|
|
|
|
stream << "EGL Result: '";
|
|
|
|
switch (error) {
|
|
case EGL_SUCCESS:
|
|
stream << "EGL_SUCCESS";
|
|
break;
|
|
case EGL_NOT_INITIALIZED:
|
|
stream << "EGL_NOT_INITIALIZED";
|
|
break;
|
|
case EGL_BAD_ACCESS:
|
|
stream << "EGL_BAD_ACCESS";
|
|
break;
|
|
case EGL_BAD_ALLOC:
|
|
stream << "EGL_BAD_ALLOC";
|
|
break;
|
|
case EGL_BAD_ATTRIBUTE:
|
|
stream << "EGL_BAD_ATTRIBUTE";
|
|
break;
|
|
case EGL_BAD_CONTEXT:
|
|
stream << "EGL_BAD_CONTEXT";
|
|
break;
|
|
case EGL_BAD_CONFIG:
|
|
stream << "EGL_BAD_CONFIG";
|
|
break;
|
|
case EGL_BAD_CURRENT_SURFACE:
|
|
stream << "EGL_BAD_CURRENT_SURFACE";
|
|
break;
|
|
case EGL_BAD_DISPLAY:
|
|
stream << "EGL_BAD_DISPLAY";
|
|
break;
|
|
case EGL_BAD_SURFACE:
|
|
stream << "EGL_BAD_SURFACE";
|
|
break;
|
|
case EGL_BAD_MATCH:
|
|
stream << "EGL_BAD_MATCH";
|
|
break;
|
|
case EGL_BAD_PARAMETER:
|
|
stream << "EGL_BAD_PARAMETER";
|
|
break;
|
|
case EGL_BAD_NATIVE_PIXMAP:
|
|
stream << "EGL_BAD_NATIVE_PIXMAP";
|
|
break;
|
|
case EGL_BAD_NATIVE_WINDOW:
|
|
stream << "EGL_BAD_NATIVE_WINDOW";
|
|
break;
|
|
case EGL_CONTEXT_LOST:
|
|
stream << "EGL_CONTEXT_LOST";
|
|
break;
|
|
default:
|
|
stream << "Unknown";
|
|
}
|
|
|
|
stream << "' (0x" << std::hex << error << std::dec << ").";
|
|
return stream.str();
|
|
}
|
|
|
|
} // namespace flutter::testing
|