You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.3 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved.
* Description: DFX define
* Author:
* Create: 2019-08-09
*/
#ifndef DFX_DEFINE_H
#define DFX_DEFINE_H
#include <uchar.h>
#include <string>
#include <securec.h>
#define ANDROID 1
#ifndef ANDROID
#include <cstdio>
#else
#include <android/log.h>
#endif
namespace dolgles {
#define DOL_LOG_VERBOSE 0
enum {
NO_ERROR = 0,
// EGL create context error
EGL_GET_DISPLAY_FAIL = 1,
EGL_INIT_FAIL = 2,
EGL_CHOOSE_CONFIG_FAIL = 3,
EGL_CREATE_CONTEXT_FAIL = 4,
EGL_CREATE_WINDOW_FAIL = 5,
EGL_NO_INIT_SURFACE = 6,
// create FBO error
FRAMEBUFFER_COMPLETE = 10,
FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 11,
FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 12,
FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 13,
FRAMEBUFFER_UNSUPPORTED = 14,
FRAMEBUFFER_NUM_IS_MAX = 15,
// GL error
CREATE_SHADER_PROGRAM_FAIL = 20,
CREATE_TEXTURE_FAIL = 21,
// Freetype error
FREETYPE_INIT_FAIL = 30,
FREETYPE_NEW_FACE_FALI = 31,
FREETYPE_CALCULATE_TEXTURE_SIZE_FAIL = 32,
DRAW_CMD_QUEUE_IS_EMPTY = 40,
UNKNOWN_ERROR = 100,
NULL_POINTER_ERROR = 101,
INVALID_PARAM
};
using EGL_U32 = unsigned int;
using EGL_S32 = int;
using EGL_CHAR = char;
using EGL_FLOAT = float;
using EGL_U8 = uint8_t;
using EGL_CHAR16 = char16_t;
#ifndef ANDROID
#ifndef LOGI
#define LOGI(format, ...) fprintf (stdout, LOG_TAG format"\n", ## __VA_ARGS__)
#endif
#ifndef LOGD
#define LOGD(format, ...) fprintf (stdout, LOG_TAG format"\n", ## __VA_ARGS__)
#endif
#ifndef LOGV
#define LOGV(format, ...) fprintf (stdout, LOG_TAG format"\n", ## __VA_ARGS__)
#endif
#ifndef LOGE
#define LOGE(format, ...) fprintf (stderr, LOG_TAG format"\n", ## __VA_ARGS__)
#endif
#else // android
#ifndef LOGE
#define LOGE(...) \
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__);
#endif
#ifndef LOGI
#define LOGI(...) \
__android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__);
#endif
#ifndef LOGD
#define LOGD(...) \
__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__);
#endif
#ifndef LOGV
#if DOL_LOG_VERBOSE
#define LOGV(...) \
__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__);
#else
#define LOGV(...) ((void)0)
#endif
#endif
#endif
}; // namespace dolgles
#endif // end DFX_DEFINE_H