yum-mirror/glslang

git clone https://git.yummers.dev/yum-mirror/glslang

Thomas NiblerPreprocessor: Implement stringify operator66de1f9f

main
926 B35 linesraw
1#version 450
2#extension GL_EXT_debug_printf : enable
3
4#define PASTE(arg) pasted_##arg
5#define STRINGIFY(arg) #arg
6#define STRINGIFY_TWICE(arg, regular) before, #arg, #arg, after, regular
7#define STRINGIFY_WITH_SPACE(arg) debugPrintfEXT( # arg
8#define PASTE_WITH_SPACE(arg) pasted_## arg
9#define BOTH(arg1,    arg2) debugPrintf##arg1(     #arg2
10#define NOARGS(arg) 1 1 1 1
11
12#define REGULAR(arg1, arg2) arg1 == arg2     ? arg2 :arg1
13#define STR(a) STRHELP(a)
14#define STRHELP(a) #a
15
16#define LEGAL(arg) a######arg
17
18bool before, after;
19
20void main() {
21    REGULAR(8,9);
22    STRINGIFY(12 3);
23    debugPrintfEXT("%d", (STRINGIFY_TWICE(letters_too,       1)));
24    STRINGIFY_WITH_SPACE(aaa1));
25
26    int PASTE(symbol);
27    float PASTE_WITH_SPACE(symbol2);
28    BOTH(EXT, string));
29    STRHELP(REGULAR(3, 4));
30    STR(REGULAR(3, 4));
31    STR(aaa     );
32    STR(STR(hello));
33    debugPrintfEXT("regular string");
34    debugPrintfEXT("");
35}