-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommon.h
57 lines (47 loc) · 1.79 KB
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef __GETIMAGE_COMMON__
#define __GETIMAGE_COMMON__
#include <stdlib.h> // exit()
#include <stdio.h> // printf()
#include <string>
/*---------------------------------------------------------------------------*/
typedef enum {
API_OPENGL,
API_OPENGL_ES,
} API_TYPE;
typedef struct {
int width;
int height;
int shaderVersion;
int APIVersion;
API_TYPE API;
int delay;
uint32_t program; // Is GLuint, but missing OpenGL headers here
std::string fragFilename;
std::string vertFilename;
std::string output;
bool exitCompile;
bool exitLinking;
bool persist;
bool animate;
bool profile;
std::string timeVarName;
std::string binOut;
} Params;
/*---------------------------------------------------------------------------*/
#define errcode_crash(errcode, fmt, ...) do { \
printf("%s:%d (%s) ERROR: ", __FILE__, __LINE__, __func__); \
printf(fmt, ##__VA_ARGS__); \
printf("\n"); \
exit (errcode); \
} while (0)
/*---------------------------------------------------------------------------*/
// Hugues: we should just call errcode_crash(EXIT_FAILURE, fmt,
// __VA_ARGS__), but compiler complains.
#define crash(fmt, ...) do { \
printf("%s:%d (%s) ERROR: ", __FILE__, __LINE__, __func__); \
printf(fmt, ##__VA_ARGS__); \
printf("\n"); \
exit (EXIT_FAILURE); \
} while (0)
/*---------------------------------------------------------------------------*/
#endif