chromium/third_party/angle/src/libANGLE/Error.h

//
// Copyright 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Error.h: Defines the egl::Error and gl::Error classes which encapsulate API errors
// and optional error messages.

#ifndef LIBANGLE_ERROR_H_
#define LIBANGLE_ERROR_H_

#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "angle_gl.h"
#include "common/angleutils.h"
#include "common/debug.h"

#include <memory>
#include <ostream>
#include <string>

namespace angle
{
template <typename ErrorT, typename ErrorBaseT, ErrorBaseT NoErrorVal, typename CodeT, CodeT EnumT>
class ErrorStreamBase : angle::NonCopyable
{};
}  // namespace angle

namespace egl
{
class Error;
}  // namespace egl

namespace egl
{

class [[nodiscard]] Error final
{};

namespace priv
{

ErrorStream;

}  // namespace priv

EglBadAccess;
EglBadAlloc;
EglBadAttribute;
EglBadConfig;
EglBadContext;
EglBadCurrentSurface;
EglBadDevice;
EglBadDisplay;
EglBadMatch;
EglBadNativeWindow;
EglBadNativePixmap;
EglBadParameter;
EglBadState;
EglBadStream;
EglBadSurface;
EglContextLost;
EglNotInitialized;

inline Error NoError()
{}

}  // namespace egl

#define ANGLE_CONCAT1
#define ANGLE_CONCAT2
#define ANGLE_LOCAL_VAR

#define ANGLE_TRY_TEMPLATE(EXPR, FUNC)

#define ANGLE_RETURN(X)
#define ANGLE_TRY(EXPR)

// TODO(jmadill): Remove after EGL error refactor. http://anglebug.com/42261727
#define ANGLE_SWALLOW_ERR(EXPR)

#undef ANGLE_LOCAL_VAR
#undef ANGLE_CONCAT2
#undef ANGLE_CONCAT1

#define ANGLE_CHECK(CONTEXT, EXPR, MESSAGE, ERROR)

namespace angle
{
// Result implements an explicit exception handling mechanism.  A value of Stop signifies an
// exception akin to |throw|.
// TODO: make incorrect usage of Stop consistent with the above expectation.
// http://anglebug.com/42266839
enum class [[nodiscard]] Result
{};

// TODO(jmadill): Remove this when refactor is complete. http://anglebug.com/42261727
egl::Error ResultToEGL(Result result);
}  // namespace angle

// TODO(jmadill): Remove this when refactor is complete. http://anglebug.com/42261727
inline bool IsError(angle::Result result)
{}

// TODO(jmadill): Remove this when refactor is complete. http://anglebug.com/42261727
inline bool IsError(const egl::Error &err)
{}

// TODO(jmadill): Remove this when refactor is complete. http://anglebug.com/42261727
inline bool IsError(bool value)
{}

// Utility macro for handling implementation methods inside Validation.
#define ANGLE_HANDLE_VALIDATION_ERR(X)

#define ANGLE_VALIDATION_TRY(EXPR)

#include "Error.inc"

#endif  // LIBANGLE_ERROR_H_