chromium/gpu/command_buffer/service/error_state.h

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This file contains the ErrorState class.

#ifndef GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_
#define GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_

#include <stdint.h>

#include "base/compiler_specific.h"
#include "gpu/gpu_gles2_export.h"

namespace gpu {
namespace gles2 {

class Logger;

// Use these macro to synthesize GL errors instead of calling the error_state
// functions directly as they will propogate the __FILE__ and __LINE__.

// Use to synthesize a GL error on the error_state.
#define ERRORSTATE_SET_GL_ERROR(error_state, error, function_name, msg)

// Use to synthesize an INVALID_ENUM GL error on the error_state. Will attempt
// to expand the enum to a string.
#define ERRORSTATE_SET_GL_ERROR_INVALID_ENUM( \
    error_state, function_name, value, label)

// Use to synthesize a GL error on the error_state for an invalid enum based
// integer parameter. Will attempt to expand the parameter to a string.
#define ERRORSTATE_SET_GL_ERROR_INVALID_PARAMI( \
    error_state, error, function_name, pname, param)

// Use to synthesize a GL error on the error_state for an invalid enum based
// float parameter. Will attempt to expand the parameter to a string.
#define ERRORSTATE_SET_GL_ERROR_INVALID_PARAMF( \
    error_state, error, function_name, pname, param)

// Use to move all pending error to the wrapper so on your next GL call
// you can see if that call generates an error.
#define ERRORSTATE_COPY_REAL_GL_ERRORS_TO_WRAPPER(error_state, function_name)
// Use to look at the real GL error and still pass it on to the user.
#define ERRORSTATE_PEEK_GL_ERROR(error_state, function_name)
// Use to clear all current GL errors. FAILS if there are any.
#define ERRORSTATE_CLEAR_REAL_GL_ERRORS(error_state, function_name)

class GPU_GLES2_EXPORT ErrorStateClient {};

class GPU_GLES2_EXPORT ErrorState {};

}  // namespace gles2
}  // namespace gpu

#endif  // GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_