Skip to content

Commit 38c4678

Browse files
committed
added __SHADY__ macro
1 parent 5607736 commit 38c4678

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/driver/vcc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int main(int argc, char** argv) {
8181
growy_append_string(g, "clang");
8282
char* self_path = get_executable_location();
8383
char* working_dir = strip_path(self_path);
84-
growy_append_formatted(g, " -c -emit-llvm -S -g -O0 -ffreestanding -Wno-main-return-type -Xclang -fpreserve-vec3-type --target=spir64-unknown-unknown -isystem\"%s/../share/vcc/include/\"", working_dir);
84+
growy_append_formatted(g, " -c -emit-llvm -S -g -O0 -ffreestanding -Wno-main-return-type -Xclang -fpreserve-vec3-type --target=spir64-unknown-unknown -isystem\"%s/../share/vcc/include/\" -D__SHADY__=1", working_dir);
8585
free(working_dir);
8686
free(self_path);
8787
growy_append_formatted(g, " -o %s", vcc_options.tmp_filename);

vcc-std/include/shady.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#ifndef _SHADY_H
22
#define _SHADY_H
33

4+
#ifndef __SHADY__
5+
#error "This header can only be used with Vcc"
6+
#endif
7+
48
#define vertex_shader __attribute__((annotate("shady::entry_point::Vertex")))
59
#define fragment_shader __attribute__((annotate("shady::entry_point::Fragment")))
610
#define compute_shader __attribute__((annotate("shady::entry_point::Compute")))

0 commit comments

Comments
 (0)