File: preprocessor.paste_stringify.vert

package info (click to toggle)
glslang 16.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 51,084 kB
  • sloc: cpp: 90,714; yacc: 4,243; sh: 603; python: 305; ansic: 94; javascript: 74; makefile: 17
file content (35 lines) | stat: -rw-r--r-- 926 bytes parent folder | download
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
#version 450
#extension GL_EXT_debug_printf : enable

#define PASTE(arg) pasted_##arg
#define STRINGIFY(arg) #arg
#define STRINGIFY_TWICE(arg, regular) before, #arg, #arg, after, regular
#define STRINGIFY_WITH_SPACE(arg) debugPrintfEXT( # arg
#define PASTE_WITH_SPACE(arg) pasted_## arg
#define BOTH(arg1,    arg2) debugPrintf##arg1(     #arg2
#define NOARGS(arg) 1 1 1 1

#define REGULAR(arg1, arg2) arg1 == arg2     ? arg2 :arg1
#define STR(a) STRHELP(a)
#define STRHELP(a) #a

#define LEGAL(arg) a######arg

bool before, after;

void main() {
    REGULAR(8,9);
    STRINGIFY(12 3);
    debugPrintfEXT("%d", (STRINGIFY_TWICE(letters_too,       1)));
    STRINGIFY_WITH_SPACE(aaa1));

    int PASTE(symbol);
    float PASTE_WITH_SPACE(symbol2);
    BOTH(EXT, string));
    STRHELP(REGULAR(3, 4));
    STR(REGULAR(3, 4));
    STR(aaa     );
    STR(STR(hello));
    debugPrintfEXT("regular string");
    debugPrintfEXT("");
}